-
Notifications
You must be signed in to change notification settings - Fork 0
/
cApp_5.asm
91 lines (71 loc) · 1.38 KB
/
cApp_5.asm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
.686
.model flat, stdcall
option casemap:none
include asesh.inc
MAX_PATH EQU 104h
.data
szData db "Asesh Shrestha", 0h
threadProc1 proto :DWORD
threadProc2 proto :DWORD
.code
start:
call main
mainLoop:
push 01Bh
call GetAsyncKeyState
cmp eax, 0h
jne exitMainLoop
push 064h
call Sleep
jmp mainLoop
exitMainLoop:
ret
main proc
local hThread[2]:DWORD, dwThreadId[2]:DWORD, dwSignalState
push sizeof hThread
lea eax, hThread
push eax
call RtlZeroMemory
lea eax, dwThreadId[0]
push eax
push 0h
push 0h
push offset threadProc1
push 0h
push 0h
call CreateThread
mov hThread[0], eax
lea eax, hThread[1]
push eax
push 0h
push 0h
push offset threadProc2
push 0h
push 0h
call CreateThread
mov hThread[1], eax
push 0FFFFFFFFh
push 1h
mov eax, [hThread]
push eax
push 2
call WaitForMultipleObjects
mov dwSignalState, eax
cmp dwSignalState, WAIT_OBJECT_0
jne _notSignaled
print chr$("The threads reached the signaled state", 0Ah)
mov ecx, 2h
_notSignaled:
ret
_loop:
ret
main endp
threadProc1 proc lpParam:DWORD
print chr$("This is a message from threadProc1", 0Ah)
ret
threadProc1 endp
threadProc2 proc lpParam:DWORD
print chr$("This is a message from threadProc2", 0Ah)
ret
threadProc2 endp
end start