Rev 3545 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
3545 | hidnplayr | 1 | |
2 | |||
3 | |||
4 | |||
5 | |||
3704 | hidnplayr | 6 | |
3545 | hidnplayr | 7 | |
8 | push esp ; reserve stack place |
||
9 | invoke getaddrinfo, first, 0, 0, esp |
||
10 | pop esi |
||
11 | ; test for error |
||
12 | test eax, eax |
||
13 | jnz exit |
||
14 | |||
15 | |||
16 | mov eax, [eax+sockaddr_in.sin_addr] |
||
17 | mov [sockaddr1.ip], eax |
||
18 | |||
19 | |||
20 | ; [server_ip]:1, [server_ip+1]:1, \ |
||
21 | ; [server_ip+2]:1, [server_ip+3]:1, \ |
||
22 | ; [server_port]:2 |
||
23 | |||
24 | |||
25 | mov [socketnum], eax |
||
26 | mcall connect, [socketnum], sockaddr1, 18 |
||
27 | |||
28 | |||
29 | |||
30 | |||
31 | jne no_rfb |
||
32 | DEBUGF 1, 'received: %s\n', receive_buffer |
||
33 | mcall send, [socketnum], handshake, 12, 0 |
||
34 | DEBUGF 1, 'Sending handshake: protocol version\n' |
||
35 | |||
36 | |||
37 | |||
38 | |||
39 | je invalid_security |
||
40 | |||
41 | |||
42 | je no_security |
||
43 | |||
44 | |||
45 | je vnc_security |
||
46 | |||
47 | |||
48 | |||
49 | |||
50 | mov byte[mode], 1 |
||
51 | call red_logon |
||
52 | |||
53 | |||
54 | mcall send, [socketnum], shared, 1, 0 |
||
55 | DEBUGF 1, 'Sending handshake: shared session?\n' |
||
56 | |||
57 | |||
58 | |||
59 | |||
60 | [receive_buffer+framebuffer.pixelformat.bpp]:1, \ |
||
61 | [receive_buffer+framebuffer.pixelformat.depth]:1, \ |
||
62 | [receive_buffer+framebuffer.pixelformat.big_endian]:1, \ |
||
63 | [receive_buffer+framebuffer.pixelformat.true_color]:1 |
||
64 | |||
65 | |||
66 | mov dword [fbur.width], eax |
||
67 | bswap eax |
||
68 | mov dword [screen], eax |
||
69 | |||
70 | |||
71 | DEBUGF 1, 'Sending pixel format\n' |
||
72 | call read_data |
||
73 | |||
74 | |||
75 | ; DEBUGF 1,'Sending encoding info\n' |
||
76 | ; call read_data |
||
77 | |||
78 | |||
79 | |||
80 | |||
81 | mov [fbur.inc], 2 |
||
82 | mcall send, [socketnum], fbur, 10, 0 |
||
83 | |||
84 | |||
85 | call read_data ; Read the data into the buffer |
||
86 | |||
87 | |||
88 | ; jb mainloop |
||
89 | |||
90 | |||
91 | |||
92 | |||
93 | je framebufferupdate |
||
94 | |||
95 | |||
96 | je setcolourmapentries |
||
97 | |||
98 | |||
99 | je bell |
||
100 | |||
101 | |||
102 | je servercuttext |
||
103 | |||
104 | |||
105 | |||
106 | |||
107 | framebufferupdate: |
||
108 | |||
109 | |||
110 | xchg al, ah |
||
111 | mov di, ax |
||
112 | DEBUGF 1, 'Framebufferupdate: %u frames\n', di |
||
113 | mov esi, receive_buffer+4 |
||
114 | jmp rectangle_loop |
||
115 | |||
116 | |||
117 | |||
118 | call drawbuffer |
||
119 | |||
120 | |||
121 | test di, di |
||
122 | jz request_rfb |
||
123 | |||
124 | |||
125 | |||
126 | |||
127 | bswap edx |
||
128 | mov ebx, edx |
||
129 | shr edx, 16 |
||
130 | mov [frame.x], dx |
||
131 | mov [frame.y], bx |
||
132 | add esi, 4 |
||
133 | mov ecx, [esi] |
||
134 | bswap ecx |
||
135 | mov eax, ecx |
||
136 | shr ecx, 16 |
||
137 | mov [frame.width], cx |
||
138 | mov [frame.height], ax |
||
139 | add esi, 4 |
||
140 | mov eax, [esi] |
||
141 | add esi, 4 |
||
142 | |||
143 | |||
144 | sub ebx, receive_buffer+12 |
||
145 | DEBUGF 1, 'frame: width=%u height=%u x=%u y=%u offset:%u encoding:',\ |
||
146 | [frame.width]:2, [frame.height]:2, [frame.x]:2, [frame.y]:2, ebx |
||
147 | |||
148 | |||
149 | je encoding_raw |
||
150 | ; cmp eax, 1 |
||
151 | ; je encoding_copyrect |
||
152 | cmp eax, 2 |
||
153 | je encoding_RRE |
||
154 | cmp eax, 5 |
||
155 | je encoding_hextile |
||
156 | cmp eax, 16 |
||
157 | je encoding_ZRLE |
||
158 | |||
159 | |||
160 | sub ebx, receive_buffer+8 |
||
161 | DEBUGF 1, '\nunknown encoding: %u (offset %u)\n', eax, ebx |
||
162 | jmp bell |
||
163 | jmp thread_loop |
||
164 | |||
165 | |||
166 | |||
167 | |||
168 | |||
169 | |||
170 | |||
171 | |||
172 | |||
173 | |||
174 | |||
175 | |||
176 | |||
177 | |||
178 | |||
179 | |||
180 | |||
181 | |||
182 | |||
183 | |||
184 | |||
185 | |||
186 | |||
187 | |||
188 | |||
189 | |||
190 | |||
191 | mcall 55, 55, , , beep |
||
192 | |||
193 | |||
194 | |||
195 | |||
196 | |||
197 | |||
198 | |||
199 | |||
200 | |||
201 | |||
202 | |||
203 | |||
204 | mov [datapointer], receive_buffer |
||
205 | .loop: |
||
206 | mcall recv, [socketnum], [datapointer], 4096, 0 |
||
207 | cmp eax, -1 |
||
208 | je .done |
||
209 | |||
210 | |||
211 | |||
212 | |||
213 | je .loop |
||
214 | |||
215 | |||
216 | mov eax, [datapointer] |
||
217 | sub eax, receive_buffer |
||
218 | ret |
||
219 | |||
220 | |||
221 | |||
222 | |||
223 | mcall recv, [socketnum], receive_buffer, 4096, 0 |
||
224 | cmp eax, -1 |
||
225 | je wait_for_data |
||
226 | test eax, eax |
||
227 | jz wait_for_data |
||
228 | |||
229 | |||
230 |