-
-
[原创]每天三篇PaPer系列之一,多线程同步问题,学习笔记~~~
-
发表于:
2010-11-1 22:27
5868
-
[原创]每天三篇PaPer系列之一,多线程同步问题,学习笔记~~~
最近定下目标,坚持每天最少三篇paper~
- -
于是有就有了下文~~~
是关于对 多线程同步的一些理解,包括 事件,临界,信号灯,互斥体~
come on~
首先
hInstance dd ?
hWinMain dd ?
hWinCount dd ?
dwCounter1 dd ?
dwCounter2 dd ?
dwThreads dd ? ;thread sum
hEvent dd ?
F_STOP equ 0001h
dwOption dd ?
004011D4 syn_fix.<模块入口点> 6A 00 push 0
004011D6 E8 63000000 call <jmp.&kernel32.GetModuleHandleA>
004011DB A3 00304000 mov dword ptr ds:[403000],eax
004011E0 6A 00 push 0
004011E2 68 7F104000 push syn_fix.0040107F ; 消息处理过程
004011E7 6A 00 push 0
004011E9 68 E8030000 push 3E8
004011EE 50 push eax
004011EF E8 08000000 call <jmp.&user32.DialogBoxParamA>
004011F4 6A 00 push 0
004011F6 E8 3D000000 call <jmp.&kernel32.ExitProcess>
____分割线
0040107F /. 55 push ebp
00401080 |. 8BEC mov ebp,esp
00401082 |. 83C4 FC add esp,-4
00401085 |. 53 push ebx
00401086 |. 57 push edi
00401087 |. 56 push esi
00401088 |. 8B45 0C mov eax,dword ptr ss:[ebp+C]
0040108B |. 3D 13010000 cmp eax,113 ; Switch (cases 10..113)
00401090 |. 75 4D jnz short syn_fix.004010DF
00401092 |. 6A FF push -1 ; /Timeout = INFINITE; Case 113 (WM_TIMER) of switch 0040108B
00401094 |. FF35 18304000 push dword ptr ds:[403018] ; |hObject = NULL
0040109A |. E8 AB010000 call <jmp.&kernel32.WaitForSingleObject>; \WaitForSingleObject
0040109F |. 6A 00 push 0 ; /IsSigned = FALSE
....
...
..
00401186 |> \3D 10010000 cmp eax,110
0040118B |. 75 2F jnz short syn_fix.004011BC
0040118D |. FF75 08 push dword ptr ss:[ebp+8] ; Case 110 (WM_INITDIALOG) of switch 0040108B
00401190 |. 8F05 04304000 pop dword ptr ds:[403004] ; 得到窗口句柄存放到数据段
00401196 |. 68 EB030000 push 3EB ; /ControlID = 3EB (1003.)
0040119B |. FF75 08 push dword ptr ss:[ebp+8] ; |hWnd
0040119E |. E8 65000000 call <jmp.&user32.GetDlgItem> ; \GetDlgItem
004011A3 |. A3 08304000 mov dword ptr ds:[403008],eax ; 获得 子控件句柄
004011A8 |. 6A 00 push 0 ; /EventName = NULL
004011AA |. 6A 01 push 1 ; |InitiallySignaled = TRUE
004011AC |. 6A 00 push 0 ; |ManualReset = FALSE
004011AE |. 6A 00 push 0 ; |pSecurity = NULL
004011B0 |. E8 77000000 call <jmp.&kernel32.CreateEventA> ; \CreateEventA
004011B5 |. A3 18304000 mov dword ptr ds:[403018],eax ; 控件的句柄
004011BA |. EB 0C jmp short syn_fix.004011C8
[培训]内核驱动高级班,冲击BAT一流互联网大厂工作,每周日13:00-18:00直播授课