首页
社区
课程
招聘
[推荐]来看下腾讯的一个消息过滤
发表于: 2011-2-5 16:10 5732

[推荐]来看下腾讯的一个消息过滤

2011-2-5 16:10
5732
代码附上
.text:00407A0B ; int __cdecl sub_407A0B(int, int)
.text:00407A0B sub_407A0B      proc near               ; CODE XREF: wWinMain(x,x,x,x)+87p
.text:00407A0B                                         ; wWinMain(x,x,x,x)+93p
.text:00407A0B
.text:00407A0B arg_0           = dword ptr  8
.text:00407A0B arg_4           = dword ptr  0Ch
.text:00407A0B
.text:00407A0B                 push    ebp
.text:00407A0C                 mov     ebp, esp
.text:00407A0E                 push    offset ProcName ; "ChangeWindowMessageFilter"
.text:00407A13                 push    offset ModuleName ; "user32.dll"
.text:00407A18                 call    ds:GetModuleHandleW
.text:00407A1E                 push    eax             ; hModule
.text:00407A1F                 call    ds:GetProcAddress
.text:00407A25                 test    eax, eax
.text:00407A27                 jnz     short loc_407A2B
.text:00407A29                 pop     ebp
.text:00407A2A                 retn
.text:00407A2B ; ---------------------------------------------------------------------------
.text:00407A2B
.text:00407A2B loc_407A2B:                             ; CODE XREF: sub_407A0B+1Cj
.text:00407A2B                 xor     ecx, ecx
.text:00407A2D                 cmp     [ebp+arg_4], ecx ; arg_4=400
.text:00407A30                 setz    cl              ; ZF=1
.text:00407A33                 inc     ecx
.text:00407A34                 push    ecx
.text:00407A35                 push    [ebp+arg_0]     ; arg_0=1
.text:00407A38                 call    eax             ; EAX(ChangeWindowMessageFilter)
.text:00407A3A                 pop     ebp
.text:00407A3B                 retn
.text:00407A3B sub_407A0B      endp

int _cdecl FunName(Uint Msg,Uint Msga)
FARPROC FunAddress;
(FARPROC&)FunAddress=GetProcAddress(GetModuleHandle(user32.dll),"ChangeWindowMessageFilter");
if(FunAddress==NULL)return ;
UINT count;
for(count=WM_NULL;count<Msga;count++)
{
ChangeWindowMessageFilter(Msg,count);
};
FunName(WM_CREATE,WM_USER)
这里还有个FunName(WM_CREATE,401)
求解401


[注意]APP应用上架合规检测服务,协助应用顺利上架!

收藏
免费 0
支持
分享
最新回复 (6)
雪    币: 278
活跃值: (709)
能力值: ( LV15,RANK:520 )
在线值:
发帖
回帖
粉丝
2
没人看,自己看
2011-2-5 17:46
0
雪    币: 437
活跃值: (130)
能力值: ( LV5,RANK:70 )
在线值:
发帖
回帖
粉丝
3

研究下子。
2011-2-5 18:05
0
雪    币: 233
活跃值: (285)
能力值: ( LV12,RANK:270 )
在线值:
发帖
回帖
粉丝
4
额……你所谓的401是十六进制还是十进制……十六进制的话,由于一般有“#define WM_USER 0x0400”,所以0x0401用来表示自定义消息,十进制的话就不知道是什么了,没用过,如果确定是十进制的话,去WinUser.h(貌似是这个文件~~)中查宏定义吧……
2011-2-5 19:49
0
雪    币: 277
活跃值: (37)
能力值: ( LV3,RANK:20 )
在线值:
发帖
回帖
粉丝
5
ChangeWindowMessageFilter是winvista以后的一个新函数,用来允许/禁止指定的用户自定义消息从低完整性进程发往高完整性进程。

MSDN说明:
UIPI is a security feature that prevents messages from being received from a lower integrity level sender. All such messages with a value above WM_USER are blocked by default. The filter, somewhat contrary to intuition, is a list of messages that are allowed through. Therefore, adding a message to the filter allows that message to be received from a lower integrity sender, while removing a message blocks that message from being received.

Certain messages with a value less than WM_USER are required to pass through the filter regardless of the filter setting. You can call this function to remove one of those messages from the filter and it will return TRUE. However, the message will still be received by the calling process.

Processes at or below SECURITY_MANDATORY_LOW_RID are not allowed to change the filter. If those processes call this function, it will fail.
2011-2-6 12:29
0
雪    币: 278
活跃值: (709)
能力值: ( LV15,RANK:520 )
在线值:
发帖
回帖
粉丝
6
谢谢各位大牛指点
2011-2-6 19:18
0
雪    币: 6
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
7
楼上的说的很清楚了噢。受益非浅
2011-2-7 17:18
0
游客
登录 | 注册 方可回帖
返回
// // 统计代码