Rev 5750 | Rev 7017 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
3618 | hidnplayr | 1 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
2 | ;; ;; |
||
5663 | hidnplayr | 3 | ;; Copyright (C) KolibriOS team 2010-2015. All rights reserved. ;; |
3618 | hidnplayr | 4 | ;; Distributed under terms of the GNU General Public License ;; |
5 | ;; ;; |
||
5668 | hidnplayr | 6 | ;; VNC client for KolibriOS ;; |
3618 | hidnplayr | 7 | ;; ;; |
8 | ;; Written by hidnplayr@kolibrios.org ;; |
||
9 | ;; ;; |
||
10 | ;; GNU GENERAL PUBLIC LICENSE ;; |
||
11 | ;; Version 2, June 1991 ;; |
||
12 | ;; ;; |
||
13 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
||
3545 | hidnplayr | 14 | |
15 | format binary as "" |
||
16 | |||
3618 | hidnplayr | 17 | __DEBUG__ = 1 |
5670 | hidnplayr | 18 | __DEBUG_LEVEL__ = 2 |
3618 | hidnplayr | 19 | |
5722 | hidnplayr | 20 | BITS_PER_PIXEL = 32 ; 8, 16, 24 or 32 |
5720 | hidnplayr | 21 | SERVERADDRLEN = 4096 |
5677 | hidnplayr | 22 | |
3545 | hidnplayr | 23 | use32 |
24 | |||
25 | org 0x0 |
||
26 | |||
5663 | hidnplayr | 27 | db "MENUET01" ; 8 byte id |
3618 | hidnplayr | 28 | dd 0x01 ; header version |
29 | dd START ; start of code |
||
30 | dd I_END ; size of image |
||
31 | dd IM_END ; memory for app |
||
32 | dd IM_END ; esp |
||
5720 | hidnplayr | 33 | dd serveraddr, 0x0 ; I_Param , I_Path |
3545 | hidnplayr | 34 | |
5663 | hidnplayr | 35 | include "../../macros.inc" |
36 | include "../../debug-fdo.inc" |
||
37 | include "../../proc32.inc" |
||
38 | include "../../dll.inc" |
||
39 | include "../../struct.inc" |
||
40 | include "../../develop/libraries/box_lib/trunk/box_lib.mac" |
||
41 | include "../../network.inc" |
||
3545 | hidnplayr | 42 | |
5722 | hidnplayr | 43 | struct PixelFormat |
5663 | hidnplayr | 44 | bpp db ? |
45 | depth db ? |
||
46 | big_endian db ? |
||
47 | true_color db ? |
||
48 | red_max dw ? |
||
49 | green_max dw ? |
||
50 | blue_max dw ? |
||
51 | red_shift db ? |
||
52 | green_shift db ? |
||
53 | blue_shift db ? |
||
54 | padding rb 3 |
||
55 | ends |
||
3545 | hidnplayr | 56 | |
5722 | hidnplayr | 57 | struct ServerInit |
5663 | hidnplayr | 58 | width dw ? |
59 | height dw ? |
||
5722 | hidnplayr | 60 | pixelformat PixelFormat |
5663 | hidnplayr | 61 | name_length dd ? |
5722 | hidnplayr | 62 | name db ? |
5663 | hidnplayr | 63 | ends |
64 | |||
5668 | hidnplayr | 65 | xpos = 4 |
5670 | hidnplayr | 66 | ypos = 21 |
5668 | hidnplayr | 67 | |
68 | TIMEOUT = 5 ; timeout in seconds |
||
69 | |||
70 | RECEIVE_BUFFER_SIZE = 8*1024*1024 ; 8 Mib |
||
71 | |||
5720 | hidnplayr | 72 | STATUS_CONNECT = 0 |
5668 | hidnplayr | 73 | STATUS_CONNECTING = 1 |
5670 | hidnplayr | 74 | STATUS_REQ_LOGIN = 2 |
75 | STATUS_LOGIN = 3 |
||
76 | STATUS_CONNECTED = 4 |
||
5680 | hidnplayr | 77 | STATUS_CLOSED = 5 |
5668 | hidnplayr | 78 | |
79 | STATUS_DISCONNECTED = 10 |
||
80 | STATUS_DNS_ERR = 11 |
||
81 | STATUS_SOCK_ERR = 12 |
||
82 | STATUS_CONNECT_ERR = 13 |
||
83 | STATUS_PROTO_ERR = 14 |
||
84 | STATUS_SECURITY_ERR = 15 |
||
85 | STATUS_LIB_ERR = 16 |
||
86 | STATUS_THREAD_ERR = 17 |
||
5680 | hidnplayr | 87 | STATUS_LOGIN_FAILED = 18 |
5720 | hidnplayr | 88 | STATUS_SECURITY_ERR_C = 19 |
5668 | hidnplayr | 89 | |
5750 | hidnplayr | 90 | WORK_FRAMEBUFFER = 1 shl 0 |
91 | WORK_CURSOR = 1 shl 1 |
||
92 | WORK_GUI = 1 shl 2 |
||
93 | |||
5715 | hidnplayr | 94 | BYTES_PER_PIXEL = (BITS_PER_PIXEL + 7) / 8 |
95 | |||
5750 | hidnplayr | 96 | if BITS_PER_PIXEL = 32 |
97 | BYTES_PER_CPIXEL= 3 |
||
98 | else |
||
99 | BYTES_PER_CPIXEL= BYTES_PER_PIXEL |
||
100 | end if |
||
101 | |||
5677 | hidnplayr | 102 | include "keymap.inc" |
5668 | hidnplayr | 103 | include "gui.inc" |
104 | include "network.inc" |
||
5663 | hidnplayr | 105 | include "raw.inc" |
5666 | hidnplayr | 106 | include "copyrect.inc" |
5668 | hidnplayr | 107 | include "rre.inc" |
5716 | hidnplayr | 108 | include "trle.inc" |
5717 | hidnplayr | 109 | include "zrle.inc" |
5750 | hidnplayr | 110 | include "cursor.inc" |
5680 | hidnplayr | 111 | include "des.inc" |
5663 | hidnplayr | 112 | |
5750 | hidnplayr | 113 | |
114 | if BITS_PER_PIXEL = 8 |
||
115 | create_lut: |
||
116 | mov edi, lut_8bpp ; 332 format |
||
117 | xor eax, eax |
||
118 | call green |
||
119 | add eax, 0x240000 |
||
120 | call green |
||
121 | add eax, 0x250000 |
||
122 | call green |
||
123 | add eax, 0x240000 |
||
124 | call green |
||
125 | add eax, 0x250000 |
||
126 | call green |
||
127 | add eax, 0x240000 |
||
128 | call green |
||
129 | add eax, 0x250000 |
||
130 | call green |
||
131 | add eax, 0x240000 |
||
132 | call green |
||
133 | ret |
||
134 | |||
135 | green: |
||
136 | mov ah, 0 |
||
137 | call blue |
||
138 | mov ah, 36 |
||
139 | call blue |
||
140 | add ah, 37 |
||
141 | call blue |
||
142 | add ah, 36 |
||
143 | call blue |
||
144 | add ah, 37 |
||
145 | call blue |
||
146 | add ah, 36 |
||
147 | call blue |
||
148 | add ah, 37 |
||
149 | call blue |
||
150 | add ah, 36 |
||
151 | call blue |
||
152 | ret |
||
153 | |||
154 | blue: |
||
155 | mov al, 0 |
||
156 | stosd |
||
157 | mov al, 85 |
||
158 | stosd |
||
159 | mov al, 170 |
||
160 | stosd |
||
161 | mov al, 255 |
||
162 | stosd |
||
163 | ret |
||
164 | end if |
||
165 | |||
166 | |||
3545 | hidnplayr | 167 | START: |
168 | |||
169 | mcall 68, 11 ; init heap |
||
170 | |||
5668 | hidnplayr | 171 | ; Load libraries |
3545 | hidnplayr | 172 | stdcall dll.Load, @IMPORT |
173 | test eax, eax |
||
5668 | hidnplayr | 174 | jz @f |
175 | mov [status], STATUS_LIB_ERR |
||
5750 | hidnplayr | 176 | jmp draw_gui.first_time |
5668 | hidnplayr | 177 | @@: |
3545 | hidnplayr | 178 | |
5750 | hidnplayr | 179 | ; When using 8BPP, create lookup table |
180 | if BITS_PER_PIXEL = 8 |
||
181 | call create_lut |
||
182 | end if |
||
183 | |||
5720 | hidnplayr | 184 | ; Check if we got a server address through parameters |
185 | cmp byte[serveraddr], 0 |
||
186 | je @f |
||
187 | xor al, al |
||
188 | mov edi, serveraddr |
||
189 | mov ecx, SERVERADDRLEN |
||
190 | repne scasb |
||
191 | sub edi, serveraddr+1 |
||
192 | mov [URLbox.size], edi |
||
193 | mov [URLbox.pos], edi |
||
194 | call open_connection |
||
195 | @@: |
||
196 | |||
5668 | hidnplayr | 197 | ; Present the user with the GUI and wait for network connection |
5750 | hidnplayr | 198 | call draw_gui.first_time |
3545 | hidnplayr | 199 | |
5668 | hidnplayr | 200 | ; Create main window |
201 | mcall 71, 1, name ; reset window caption (add server name) |
||
3545 | hidnplayr | 202 | |
5663 | hidnplayr | 203 | mov edx, dword[screen] |
3545 | hidnplayr | 204 | movzx esi, dx |
205 | shr edx, 16 |
||
206 | add edx, 2*xpos |
||
207 | add esi, ypos+xpos |
||
208 | mcall 67, 10, 10 ; resize the window |
||
209 | |||
5668 | hidnplayr | 210 | mcall 40, EVM_MOUSE + EVM_MOUSE_FILTER + EVM_KEY + EVM_REDRAW + EVM_BUTTON |
211 | |||
5670 | hidnplayr | 212 | mcall 66, 1, 1 ; Switch keyboard to scancode mode |
213 | |||
5677 | hidnplayr | 214 | call generate_keymap |
215 | |||
5668 | hidnplayr | 216 | redraw: |
217 | mcall 12, 1 |
||
218 | |||
219 | mov ebx, dword[screen] |
||
220 | movzx ecx, bx |
||
221 | shr ebx, 16 |
||
222 | mov edx, 0x74ffffff |
||
223 | mov edi, name |
||
224 | mcall 0 ; draw window |
||
225 | |||
226 | mcall 12, 2 |
||
227 | |||
5670 | hidnplayr | 228 | draw_framebuffer: |
5720 | hidnplayr | 229 | DEBUGF 1, "Drawing framebuffer\n" |
5722 | hidnplayr | 230 | mcall 7, framebuffer, dword[screen], 0 |
5750 | hidnplayr | 231 | and [work], not WORK_FRAMEBUFFER |
5670 | hidnplayr | 232 | |
3545 | hidnplayr | 233 | mainloop: |
5668 | hidnplayr | 234 | cmp [status], STATUS_CONNECTED |
235 | jne draw_gui |
||
5750 | hidnplayr | 236 | test [work], WORK_FRAMEBUFFER |
237 | jnz draw_framebuffer |
||
238 | test [work], WORK_CURSOR |
||
239 | jnz update_cursor |
||
3545 | hidnplayr | 240 | |
5750 | hidnplayr | 241 | mcall 23, 10 ; Check for event with 0,1s timeout |
5668 | hidnplayr | 242 | |
3545 | hidnplayr | 243 | dec eax |
244 | jz redraw |
||
245 | dec eax |
||
246 | jz key |
||
247 | dec eax |
||
248 | jz button |
||
249 | sub eax, 3 |
||
250 | jz mouse |
||
251 | jmp mainloop |
||
252 | |||
253 | key: |
||
5677 | hidnplayr | 254 | mcall 66, 3 |
5693 | hidnplayr | 255 | mov ebx, eax ; get modifier keys |
5677 | hidnplayr | 256 | |
5693 | hidnplayr | 257 | mcall 2 ; get key scancode |
258 | cmp ah, 224 ; extended keycode? |
||
259 | je .extended |
||
3545 | hidnplayr | 260 | |
5670 | hidnplayr | 261 | xor al, al |
262 | test ah, 0x80 ; key up? |
||
263 | jnz @f |
||
264 | inc al |
||
5755 | hidnplayr | 265 | and ah, 0x7f |
5670 | hidnplayr | 266 | @@: |
267 | mov byte[KeyEvent.down], al |
||
268 | |||
5693 | hidnplayr | 269 | movzx eax, ah |
5670 | hidnplayr | 270 | |
5677 | hidnplayr | 271 | test ebx, 100000b ; alt? |
5693 | hidnplayr | 272 | jz .no_alt |
273 | mov ax, [keymap_alt+eax*2] |
||
5677 | hidnplayr | 274 | jmp .key |
5693 | hidnplayr | 275 | .no_alt: |
276 | |||
5677 | hidnplayr | 277 | test ebx, 11b ; shift? |
5693 | hidnplayr | 278 | jz .no_shift |
279 | mov ax, [keymap_shift+eax*2] |
||
280 | jmp .key |
||
281 | .no_shift: |
||
282 | |||
283 | test ebx, 10000000b ; numlock ? |
||
284 | jz .no_numlock |
||
285 | cmp al, 71 |
||
286 | jb .no_numlock |
||
287 | cmp al, 83 |
||
288 | ja .no_numlock |
||
289 | mov ah, [keymap_numlock+eax-71] |
||
290 | xor al, al |
||
291 | jmp .key |
||
292 | |||
293 | .extended: ; extended keys always use regular keymap |
||
294 | mcall 2 |
||
295 | shr eax, 8 |
||
296 | jz mainloop |
||
5755 | hidnplayr | 297 | |
298 | xor ah, ah |
||
299 | test al, 0x80 ; key up? |
||
300 | jnz @f |
||
301 | inc ah |
||
302 | @@: |
||
303 | mov byte[KeyEvent.down], ah |
||
304 | and ax, 0x007f |
||
5693 | hidnplayr | 305 | .no_numlock: |
306 | mov ax, [keymap+eax*2] |
||
5677 | hidnplayr | 307 | .key: |
5693 | hidnplayr | 308 | test ax, ax |
309 | jz mainloop |
||
5677 | hidnplayr | 310 | mov word[KeyEvent.key+2], ax |
311 | DEBUGF 1, "Sending key: 0x%x\n", ax |
||
5668 | hidnplayr | 312 | mcall send, [socketnum], KeyEvent, 8, 0 |
3545 | hidnplayr | 313 | jmp mainloop |
314 | |||
5677 | hidnplayr | 315 | |
5693 | hidnplayr | 316 | |
3545 | hidnplayr | 317 | mouse: |
5677 | hidnplayr | 318 | ; DEBUGF 1, "Sending pointer event\n" |
3545 | hidnplayr | 319 | |
320 | mcall 37, 1 ; get mouse pos |
||
321 | bswap eax |
||
5668 | hidnplayr | 322 | mov [PointerEvent.x], ax |
3545 | hidnplayr | 323 | shr eax, 16 |
5668 | hidnplayr | 324 | mov [PointerEvent.y], ax |
3545 | hidnplayr | 325 | |
326 | mcall 37, 2 ; get mouse buttons |
||
327 | test al, 00000010b ; test if right button was pressed (bit 1 in kolibri) |
||
328 | jz @f |
||
5663 | hidnplayr | 329 | add al, 00000010b ; in RFB protocol it is bit 2, so if we add bit 2 again, we"ll get bit 3 and bit 1 will remain the same |
3545 | hidnplayr | 330 | @@: |
5668 | hidnplayr | 331 | mov [PointerEvent.mask], al |
3545 | hidnplayr | 332 | |
5668 | hidnplayr | 333 | mcall send, [socketnum], PointerEvent, 6, 0 |
3545 | hidnplayr | 334 | jmp mainloop |
335 | |||
336 | button: |
||
337 | mcall 17 ; get id |
||
5680 | hidnplayr | 338 | mov [status], STATUS_CLOSED |
5677 | hidnplayr | 339 | mcall close, [socketnum] |
3545 | hidnplayr | 340 | mcall -1 |
341 | |||
342 | |||
5750 | hidnplayr | 343 | update_cursor: |
344 | |||
345 | ; load cursor |
||
346 | mov dx, word[cursor.y] |
||
347 | shl edx, 16 |
||
348 | mov dx, 2 |
||
349 | mcall 37, 4, cursor.image |
||
350 | test eax, eax |
||
351 | jz .fail |
||
352 | |||
353 | ; set cursor |
||
354 | mov ecx, eax |
||
355 | mcall 37, 5 |
||
356 | |||
357 | ; delete previously set cursor |
||
358 | mov ecx, eax |
||
359 | mcall 37, 6 |
||
360 | |||
361 | .fail: |
||
362 | and [work], not WORK_CURSOR |
||
363 | jmp mainloop |
||
364 | |||
365 | |||
5668 | hidnplayr | 366 | ; DATA AREA |
3545 | hidnplayr | 367 | |
5668 | hidnplayr | 368 | include_debug_strings |
3545 | hidnplayr | 369 | |
5693 | hidnplayr | 370 | keymap_numlock: |
371 | db '7', '8', '9', '-' |
||
372 | db '4', '5', '6', '+' |
||
373 | db '1', '2', '3' |
||
374 | db '0', '.' |
||
375 | |||
5668 | hidnplayr | 376 | HandShake db "RFB 003.003", 10 |
3545 | hidnplayr | 377 | |
5668 | hidnplayr | 378 | ClientInit db 0 ; not shared |
3545 | hidnplayr | 379 | |
5750 | hidnplayr | 380 | if BITS_PER_PIXEL = 32 |
381 | |||
382 | SetPixelFormat db 0 ; setPixelformat |
||
5668 | hidnplayr | 383 | db 0, 0, 0 ; padding |
384 | .bpp db 32 ; bits per pixel |
||
5722 | hidnplayr | 385 | .depth db 24 ; depth |
5668 | hidnplayr | 386 | .big_endian db 0 ; big-endian flag |
387 | .true_color db 1 ; true-colour flag |
||
388 | .red_max db 0, 255 ; red-max |
||
389 | .green_max db 0, 255 ; green-max |
||
390 | .blue_max db 0, 255 ; blue-max |
||
5722 | hidnplayr | 391 | .red_shift db 16 ; red-shift |
5668 | hidnplayr | 392 | .green_shift db 8 ; green-shift |
5722 | hidnplayr | 393 | .blue_shift db 0 ; blue-shift |
5668 | hidnplayr | 394 | db 0, 0, 0 ; padding |
3545 | hidnplayr | 395 | |
5750 | hidnplayr | 396 | else if BITS_PER_PIXEL = 24 |
397 | |||
398 | SetPixelFormat db 0 ; setPixelformat |
||
5677 | hidnplayr | 399 | db 0, 0, 0 ; padding |
400 | .bpp db 24 ; bits per pixel |
||
401 | .depth db 24 ; depth |
||
402 | .big_endian db 0 ; big-endian flag |
||
403 | .true_color db 1 ; true-colour flag |
||
404 | .red_max db 0, 255 ; red-max |
||
405 | .green_max db 0, 255 ; green-max |
||
406 | .blue_max db 0, 255 ; blue-max |
||
407 | .red_shift db 16 ; red-shift |
||
408 | .green_shift db 8 ; green-shift |
||
409 | .blue_shift db 0 ; blue-shift |
||
410 | db 0, 0, 0 ; padding |
||
411 | |||
5750 | hidnplayr | 412 | else if BITS_PER_PIXEL = 16 |
413 | |||
414 | SetPixelFormat db 0 ; setPixelformat |
||
5668 | hidnplayr | 415 | db 0, 0, 0 ; padding |
416 | .bpp db 16 ; bits per pixel |
||
5677 | hidnplayr | 417 | .depth db 16 ; depth |
5668 | hidnplayr | 418 | .big_endian db 0 ; big-endian flag |
419 | .true_color db 1 ; true-colour flag |
||
420 | .red_max db 0, 31 ; red-max |
||
5677 | hidnplayr | 421 | .green_max db 0, 63 ; green-max |
5668 | hidnplayr | 422 | .blue_max db 0, 31 ; blue-max |
5677 | hidnplayr | 423 | .red_shift db 11 ; red-shift |
5668 | hidnplayr | 424 | .green_shift db 5 ; green-shift |
5677 | hidnplayr | 425 | .blue_shift db 0 ; blue-shift |
5668 | hidnplayr | 426 | db 0, 0, 0 ; padding |
3545 | hidnplayr | 427 | |
5750 | hidnplayr | 428 | else if BITS_PER_PIXEL = 8 |
429 | |||
430 | SetPixelFormat db 0 ; setPixelformat |
||
5668 | hidnplayr | 431 | db 0, 0, 0 ; padding |
432 | .bpp db 8 ; bits per pixel |
||
5677 | hidnplayr | 433 | .depth db 8 ; depth |
5668 | hidnplayr | 434 | .big_endian db 0 ; big-endian flag |
435 | .true_color db 1 ; true-colour flag |
||
5677 | hidnplayr | 436 | .red_max db 0, 7 ; red-max |
437 | .green_max db 0, 7 ; green-max |
||
5668 | hidnplayr | 438 | .blue_max db 0, 3 ; blue-max |
5750 | hidnplayr | 439 | .red_shift db 5 ; red-shift |
440 | .green_shift db 2 ; green-shift |
||
441 | .blue_shift db 0 ; blue-shift |
||
5668 | hidnplayr | 442 | db 0, 0, 0 ; padding |
3545 | hidnplayr | 443 | |
5750 | hidnplayr | 444 | end if |
445 | |||
5668 | hidnplayr | 446 | SetEncodings db 2 ; setEncodings |
447 | db 0 ; padding |
||
5750 | hidnplayr | 448 | db 0, 5 ; number of encodings |
5720 | hidnplayr | 449 | ; db 0, 0, 0, 16 ; ZRLE |
450 | db 0, 0, 0, 15 ; TRLE |
||
451 | db 0, 0, 0, 2 ; RRE |
||
5668 | hidnplayr | 452 | db 0, 0, 0, 1 ; Copyrect encoding |
5750 | hidnplayr | 453 | db 0xff, 0xff, 0xff, 0x11 ; Cursor pseudo encoding |
5715 | hidnplayr | 454 | db 0, 0, 0, 0 ; raw encoding |
5708 | hidnplayr | 455 | .length = $ - SetEncodings |
3545 | hidnplayr | 456 | |
5668 | hidnplayr | 457 | FramebufferUpdateRequest db 3 |
458 | .inc db 0 ; incremental |
||
459 | .x dw 0 |
||
460 | .y dw 0 |
||
461 | .width dw 0 |
||
462 | .height dw 0 |
||
3545 | hidnplayr | 463 | |
5668 | hidnplayr | 464 | KeyEvent db 4 ; keyevent |
465 | .down db 0 ; down-flag |
||
466 | dw 0 ; padding |
||
467 | .key dd 0 ; key |
||
3545 | hidnplayr | 468 | |
5668 | hidnplayr | 469 | PointerEvent db 5 ; pointerevent |
470 | .mask db 0 ; button-mask |
||
471 | .x dw 0 ; x-position |
||
472 | .y dw 0 ; y-position |
||
3545 | hidnplayr | 473 | |
474 | |||
475 | sockaddr1: |
||
5668 | hidnplayr | 476 | dw AF_INET4 |
477 | .port dw 0x0c17 ; 5900 |
||
478 | .ip dd 0 |
||
479 | rb 10 |
||
3545 | hidnplayr | 480 | |
5668 | hidnplayr | 481 | beep db 0x85, 0x25, 0x85, 0x40, 0 |
5663 | hidnplayr | 482 | |
5720 | hidnplayr | 483 | status dd STATUS_CONNECT |
5750 | hidnplayr | 484 | work dd 0 |
5670 | hidnplayr | 485 | mouse_dd dd 0 |
5720 | hidnplayr | 486 | thread_id dd 0 |
5668 | hidnplayr | 487 | |
5717 | hidnplayr | 488 | deflate_buffer dd 0 |
489 | deflate_length dd ? |
||
490 | deflate_str dd ? |
||
491 | |||
5720 | hidnplayr | 492 | URLbox edit_box 235, 70, 20, 0xffffff, 0x6f9480, 0, 0, 0, SERVERADDRLEN, serveraddr, mouse_dd, ed_focus, 0, 0 |
5693 | hidnplayr | 493 | USERbox edit_box 215, 90, 10, 0xffffff, 0x6f9480, 0, 0, 0, 127, username, mouse_dd, ed_focus, 0, 0 |
494 | PASSbox edit_box 215, 90, 30, 0xffffff, 0x6f9480, 0, 0, 0, 127, password, mouse_dd, ed_pass, 0, 0 |
||
5663 | hidnplayr | 495 | |
5668 | hidnplayr | 496 | serverstr db "server:" |
497 | userstr db "username:" |
||
498 | passstr db "password:" |
||
5670 | hidnplayr | 499 | connectstr db "Connect" |
500 | loginstr db "Log in" |
||
5720 | hidnplayr | 501 | cancelstr db "Cancel" |
502 | okstr db "OK" |
||
503 | okstr_e: |
||
5668 | hidnplayr | 504 | |
5720 | hidnplayr | 505 | sz_err_disconnected db "The server has closed the connection unexpectedly.", 0 |
5668 | hidnplayr | 506 | sz_err_dns db "Could not resolve hostname.", 0 |
507 | sz_err_sock db "Could not open socket.", 0 |
||
508 | sz_err_connect db "Could not connect to the server.", 0 |
||
509 | sz_err_proto db "A protocol error has occured.", 0 |
||
5720 | hidnplayr | 510 | sz_err_security db "An authentication problem has occured.", 0 |
5668 | hidnplayr | 511 | sz_err_library db "Could not load needed libraries.", 0 |
512 | sz_err_thread db "Could not create thread.", 0 |
||
5680 | hidnplayr | 513 | sz_err_login_failed db "Login failed.", 0 |
5668 | hidnplayr | 514 | |
515 | err_msg dd sz_err_disconnected |
||
516 | dd sz_err_dns |
||
517 | dd sz_err_sock |
||
518 | dd sz_err_connect |
||
519 | dd sz_err_proto |
||
520 | dd sz_err_security |
||
521 | dd sz_err_library |
||
522 | dd sz_err_thread |
||
5680 | hidnplayr | 523 | dd sz_err_login_failed |
5720 | hidnplayr | 524 | dd sz_err_security_c |
5668 | hidnplayr | 525 | |
3545 | hidnplayr | 526 | ; import |
527 | align 4 |
||
528 | @IMPORT: |
||
529 | |||
5663 | hidnplayr | 530 | library network, "network.obj",\ |
531 | box_lib, "box_lib.obj",\ |
||
532 | archiver, "archiver.obj" |
||
3545 | hidnplayr | 533 | |
5663 | hidnplayr | 534 | import network,\ |
535 | getaddrinfo, "getaddrinfo", \ |
||
536 | freeaddrinfo, "freeaddrinfo", \ |
||
537 | inet_ntoa, "inet_ntoa" |
||
3545 | hidnplayr | 538 | |
5663 | hidnplayr | 539 | import box_lib,\ |
540 | edit_box_draw, "edit_box",\ |
||
541 | edit_box_key, "edit_box_key",\ |
||
542 | edit_box_mouse, "edit_box_mouse",\ |
||
543 | scrollbar_v_draw, "scrollbar_v_draw",\ |
||
544 | scrollbar_v_mouse, "scrollbar_v_mouse",\ |
||
545 | scrollbar_h_draw, "scrollbar_h_draw",\ |
||
546 | scrollbar_h_mouse, "scrollbar_h_mouse" |
||
547 | |||
548 | import archiver,\ |
||
5717 | hidnplayr | 549 | deflate_unpack2, "deflate_unpack2" |
5663 | hidnplayr | 550 | |
5668 | hidnplayr | 551 | name db "VNC viewer " |
552 | .dash db 0, " " |
||
5663 | hidnplayr | 553 | |
3545 | hidnplayr | 554 | I_END: |
555 | |||
5663 | hidnplayr | 556 | servername rb 64+1 |
3545 | hidnplayr | 557 | |
5720 | hidnplayr | 558 | serveraddr db 0 |
559 | rb SERVERADDRLEN |
||
560 | |||
5663 | hidnplayr | 561 | socketnum dd ? |
562 | datapointer dd ? |
||
5668 | hidnplayr | 563 | |
5663 | hidnplayr | 564 | rectangles dw ? |
3545 | hidnplayr | 565 | |
5663 | hidnplayr | 566 | rectangle: |
5668 | hidnplayr | 567 | .x dd ? |
568 | .y dd ? |
||
569 | .width dd ? |
||
570 | .height dd ? |
||
3545 | hidnplayr | 571 | |
5668 | hidnplayr | 572 | subrectangles dd ? |
573 | |||
574 | subrectangle: |
||
575 | .x dd ? |
||
576 | .y dd ? |
||
577 | .width dd ? |
||
578 | .height dd ? |
||
579 | |||
5663 | hidnplayr | 580 | screen: ; Remote screen resolution |
581 | .height dw ? |
||
582 | .width dw ? |
||
3545 | hidnplayr | 583 | |
5716 | hidnplayr | 584 | palette rd 128 ; TRLE/ZRLE |
585 | palettesize db ? ; TRLE/ZRLE |
||
586 | |||
5677 | hidnplayr | 587 | keymap rw 128 |
588 | keymap_shift rw 128 |
||
589 | keymap_alt rw 128 |
||
5670 | hidnplayr | 590 | username rb 128 |
591 | password rb 128 |
||
5750 | hidnplayr | 592 | keys rd 32*2 ; DES keys for VNC authentication |
5680 | hidnplayr | 593 | |
5750 | hidnplayr | 594 | cursor: |
595 | .y db ? |
||
596 | .x db ? |
||
597 | .image rd 32*32 |
||
598 | |||
599 | align 4 |
||
600 | if BITS_PER_PIXEL = 8 |
||
601 | lut_8bpp rd 256 |
||
602 | end if |
||
603 | |||
5720 | hidnplayr | 604 | sz_err_security_c rb 512+1 |
605 | |||
5668 | hidnplayr | 606 | receive_buffer rb RECEIVE_BUFFER_SIZE |
5722 | hidnplayr | 607 | framebuffer rb 1280*1024*3 ; framebuffer |
3545 | hidnplayr | 608 | |
5663 | hidnplayr | 609 | rb 0x1000 |
3545 | hidnplayr | 610 | thread_stack: |
5663 | hidnplayr | 611 | rb 0x1000 |
3545 | hidnplayr | 612 | IM_END: |
613 |