首页
社区
课程
招聘
[求助]读一份驱动代码,有2处不明白,请大侠救助
发表于: 2008-4-3 19:19 4865

[求助]读一份驱动代码,有2处不明白,请大侠救助

2008-4-3 19:19
4865
★代码如下:

mov eax,CR0      
and eax,not 0x10000  //eax的第29位清零,该位是无意义的,正常就应该为零
mov CR0,eax

该代码目的是什么?

★代码有如下宏定义,宏定义中的“##”符号是什么意思

#define MemCheckAndHandle(nr,type,varsize,value) if ( /*it's faster to do this in a seperate code segment for each type, but lets try this first (less code)*/ \
        ((CurrentScan.Scantype==ST_Exact_value) && (*(##type)mempointer==value)) ||\
        ((CurrentScan.Scantype==ST_SmallerThan) && (*(##type)mempointer<value)) ||\
        ((CurrentScan.Scantype==ST_BiggerThan) && (*(##type)mempointer>value))\
        )\
        {\
                /*found one*/ \
                DbgPrint("Found one!!!\n");\
                AddressList[found]=(ULONG)mempointer;\
                ValueList##nr[found]=*(##type)mempointer;\
                found++;\
                if (found==AddressListSize)\
                {\
                        DbgPrint("Writing tempfile\n");\
                        \
                        /*write the addresses and values to disk*/ \
                        CETC_Write(addressfile,AddressList,found*4,&iosb);\
                        CETC_Write(valuefile,ValueList##nr,found*varsize,&iosb);\
\
                        foundsaved+=found;\
                        found=0;\
                }\
        }


[培训]内核驱动高级班,冲击BAT一流互联网大厂工作,每周日13:00-18:00直播授课

收藏
免费 0
支持
分享
最新回复 (5)
雪    币: 2134
活跃值: (14)
能力值: (RANK:170 )
在线值:
发帖
回帖
粉丝
2
1 启用内存保护机制
2 看这里:9ceK9s2c8@1M7q4)9K6b7g2)9J5c8W2)9J5c8Y4N6%4N6#2)9J5k6h3q4C8j5h3g2Q4x3X3g2U0L8W2)9J5c8Y4y4H3j5h3y4W2i4K6u0r3K9s2c8E0L8q4)9J5c8U0b7I4i4K6u0r3N6q4)9J5k6o6b7I4i4K6u0W2K9s2c8E0L8l9`.`.
748K9s2c8@1M7q4)9K6b7g2)9J5c8W2)9J5c8Y4N6%4N6#2)9J5k6i4m8S2M7%4x3I4x3o6m8Q4x3X3g2F1k6i4c8Q4x3V1k6B7K9i4y4#2j5h3&6B7K9g2)9J5c8X3c8W2L8X3N6B7K9g2)9J5c8X3g2J5K9X3W2Q4x3V1j5I4x3e0t1J5x3e0m8Q4x3X3g2Z5N6r3#2D9
2008-4-3 19:47
0
雪    币: 207
活跃值: (10)
能力值: ( LV4,RANK:50 )
在线值:
发帖
回帖
粉丝
3
操作符##把两个标记拼在一起。例如:define ss(a,b)   a ## b
ss(x,y)预处理后成为 ab。
2008-4-3 20:36
0
雪    币: 424
活跃值: (2494)
能力值: ( LV3,RANK:30 )
在线值:
发帖
回帖
粉丝
4
1、目的是清除CR0的第16位WP位,WP位在Intel手册3A卷2.5节中有描述
WP Write Protect (bit 16 of CR0) — Inhibits supervisor-level procedures from
writing into user-level read-only pages when set; allows supervisor-level
procedures to write into user-level read-only pages when clear (regardless of
the U/S bit setting; see Section 3.7.6). This flag facilitates implementation of
the copy-on-write method of creating a new process (forking) used by oper-
ating systems such as UNIX.
2008-4-3 21:46
0
雪    币: 197
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
5
谢谢大家的热心帮助,谢谢
2008-4-5 01:20
0
雪    币: 211
活跃值: (366)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
6
Intel手册 ?好东西
2008-4-8 22:06
0
游客
登录 | 注册 方可回帖
返回