设为首页 收藏本站
查看: 1048|回复: 0

[经验分享] 《深入理解Windows操作系统》笔记5

[复制链接]

尚未签到

发表于 2016-5-20 11:16:40 | 显示全部楼层 |阅读模式
Windows全局标志保存在一个名为NtGlobalFlag的系统范围的全局变量中,此变量通过HKLM\SYSTEM\CurrentControlSet\Control\Sessionmanager\Globalflag来初始化的,默认值是0。使用gflag /?。
C:\Program Files\Support Tools>gflags /?

usage: GFLAGS [-r [<Flags>] |
              [-k [<Flags>]] |
              [-i <ImageFileName> [<Flags>]] |
              [-i <ImageFileName> -tracedb <SizeInMb>] |
              [-p <PageHeapOptions>] (use `-p ?' for help)

where: <Flags> is a 32 bit hex number (0x12345678) that specifies
       one or more global flags to set.
       -r operates on system registry settings.
       -k operates on kernel settings of the running system.
       -i operates on settings for a specific image file.

       If only the switch is specified, then current settings
       are displayed, not modified.  If flags specified for -i
       option are FFFFFFFF, then registry entry for that image
       is deleted

The `-tracedb' option is used to set the size of the stack trace
database used to store runtime stack traces. The actual database
will be created if the `+ust' flag is set in a previous command.
`-tracedb 0' will revert to the default size for the database.

If no arguments are specified to GFLAGS then it displays
a dialog box that allows the user to modify the global
flag settings.

Flags may either be a single hex number that specifies all
32-bits of the GlobalFlags value, or it can be one or more
arguments, each beginning with a + or -, where the + means
to set the corresponding bit(s) in the GlobalFlags and a =
means to clear the corresponding bit(s).  After the + or =
may be either a hex number or a three letter abbreviation
for a GlobalFlag.  Valid abbreviations are:

    soe - Stop On Exception
    sls - Show Loader Snaps
    dic - Debug Initial Command
    shg - Stop on Hung GUI
    htc - Enable heap tail checking
    hfc - Enable heap free checking
    hpc - Enable heap parameter checking
    hvc - Enable heap validation on call
    vrf - Enable application verifier
    ptg - Enable pool tagging
    htg - Enable heap tagging
    ust - Create user mode stack trace database
    kst - Create kernel mode stack trace database
    otl - Maintain a list of objects for each type
    htd - Enable heap tagging by DLL
    dse - Disable stack extensions
    d32 - Enable debugging of Win32 Subsystem
    ksl - Enable loading of kernel debugger symbols
    dps - Disable paging of kernel stacks
    scb - Enable system critical breaks
    dhc - Disable Heap Coalesce on Free
    ece - Enable close exception
    eel - Enable exception logging
    eot - Enable object handle type tagging
    hpa - Enable page heap
    dwl - Debug WINLOGON
    ddp - Disable kernel mode DbgPrint output
    cse - Early critical section event creation
    ltd - Load DLLs top-down
    bhd - Enable bad handles detection
    dpd - Disable protected DLL verification

All images with ust enabled can be accessed in the
USTEnabled key under 'Image File Options'.

C:\Program Files\Support Tools>
DSC0000.gif


本地调用过程LPC是一种用于高速传递消息的跨进程通信设施。并不是通过windows API直接可以使用,是一种内部机制,只能用于windows操作系统逐渐。用到LPC的地方:
使用了远程过程调用RPC的windows应用程序,如果他们指定了本地RPC,用于在同一个系统上的进程之间进行通讯
一些windows API要向windows子系统进程发送消息
Winlogon通过LPC与本地安全认证服务器进程LSASS进行通信
安全应用监视器使用LPC和LSASS进程进行通讯。

查看LPC端口对象:winobj程序
DSC0001.gif

64bit的windows如何运行win32的程序,使用的wow64的DLL来实现的:
wow64.DLL:管理线程和进程的创建,钩子程序异常分发,和ntoskrnl导出的基本系统调用,实现了文件重定向,注册表重定向和反射
WOW64CPU.DLL:为每个正在WOW64内部运行的线程,管理他们的32位CPU环境
WOW64WIN.DLL:截取了win32K.SYS导出的GUI调用。
关系如下:
DSC0002.gif
在注册表中为什么HKEY等根键都是以H开头而不是以ROOT开头?
因为:所以指向KEY是windows的句柄Handle,参考technical reference to the windows 2000 registry帮助文件。

在HKLM\HARDWARE\DESCRIPTION\SYSTEM\CENTRALPROCESSOR\0下的PROCESSORNAMESTRING 可以让我的电脑属性看为牛B的CPU。
DSC0003.gif


可以使用regmon来实现监控注册表,regmon实际上依赖一个设备驱动程序
现在和filemon一起被procmon替代了。
DSC0004.gif

注册表的内部机理:实现注册表的执行体子系统是配置管理器,配置管理器是如何组织指标表的磁盘文件的呢?是通过一个hive 存储巢穴来做到的。
对于本机来说对应关系如下:
DSC0005.gif
系统修复和还原是通过regedit 的load hive来实现的。相当于恢复注册表

Hive的大小是有限制的。在XP和2003上,hive的最高达到200M,或者物理内存的1/4.
WINDOWS 2000中设计了换页池的概念,大小限制376M。而在XP和2003上,registry size中没有显示,因为配置管理器不适用换页池。
查看HIVE的内存使用量:
DSC0006.gif
0: kd> !reg hivelist

-------------------------------------------------------------------------------------------------------------
| HiveAddr |Stable Length|Stable Map|Volatile Length|Volatile Map|MappedViews|PinnedViews|U(Cnt)| BaseBlock | FileName
-------------------------------------------------------------------------------------------------------------
| e270ab60 |      33000  | e270abc0 |          0    |  00000000  |        0  |       13  |     0| e220e000  | \Microsoft\Windows\UsrClass.dat
| e2571378 |     23f000  | e222a000 |       1000    |  e25714b4  |       76  |       24  |     0| e220b000  | s and Settings\jamin\ntuser.dat
| e21a0b60 |       1000  | e21a0bc0 |          0    |  00000000  |        1  |        0  |     0| e227a000  | \Microsoft\Windows\UsrClass.dat
| e22aa008 |      39000  | e22aa068 |       1000    |  e22aa144  |       15  |        0  |     0| e22ad000  | ettings\LocalService\ntuser.dat
| e20edb60 |       1000  | e20edbc0 |          0    |  00000000  |        1  |        0  |     0| e2113000  | \Microsoft\Windows\UsrClass.dat
| e2103558 |      39000  | e21035b8 |       1000    |  e2103694  |       13  |        2  |     0| e1eaa000  | tings\NetworkService\ntuser.dat
| e16b7b60 |    27df000  | e16fe000 |       c000    |  e16b7c9c  |      256  |        5  |     0| e16b9000  | emRoot\System32\Config\SOFTWARE
| e16bf008 |       7000  | e16bf068 |          0    |  00000000  |        2  |        0  |     0| e16c1000  | \SystemRoot\System32\Config\SAM
| e162e820 |       d000  | e162e880 |       1000    |  e162e95c  |        4  |        0  |     0| e16ac000  | emRoot\System32\Config\SECURITY
| e16bcb60 |      3d000  | e16bcbc0 |          0    |  00000000  |       16  |        0  |     0| e16ae000  | temRoot\System32\Config\DEFAULT
| e143d3c0 |       d000  | e143d420 |       4000    |  e143d4fc  |        0  |        0  |     0| e1440000  | <NONAME>
| e1036b60 |     3f7000  | e1038000 |      26000    |  e1036c9c  |      141  |       29  |     0| e1037000  | SYSTEM
| e1024b60 |       1000  | e1024bc0 |       1000    |  e1024c9c  |        0  |        0  |     0| e102f000  | <NONAME>
-------------------------------------------------------------------------------------------------------------
在Windows\SYSTEM32\CONFIG中有一个隐藏文件,system.SAV是SYSTEM的HIVE的一个版本,是初始拷贝,是从SETUP的ISO上拷贝来的。

在windows2000中相同路径,有一个非隐藏文件system.ALT是一个替补,在WINDOWS XP/2003后面没有

Windows服务类似于unix的守护进程,服务有3个部分组成:服务应用,服务控制程序SCP,服务控制管理器SCM

运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-219527-1-1.html 上篇帖子: 如何制作 Windows XP 的 USB 启动盘 下篇帖子: Windows 无法删除文件夹的只读
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表