Rev 5771 | 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 |
5771 | hidnplayr | 198 | jmp draw_gui.first_time |
3545 | hidnplayr | 199 | |
5668 | hidnplayr | 200 | ; Create main window |
5771 | hidnplayr | 201 | connected: |
5668 | hidnplayr | 202 | mcall 71, 1, name ; reset window caption (add server name) |
3545 | hidnplayr | 203 | |
5663 | hidnplayr | 204 | mov edx, dword[screen] |
3545 | hidnplayr | 205 | movzx esi, dx |
206 | shr edx, 16 |
||
207 | add edx, 2*xpos |
||
208 | add esi, ypos+xpos |
||
209 | mcall 67, 10, 10 ; resize the window |
||
210 | |||
5771 | hidnplayr | 211 | mcall 40, EVM_CURSOR_FILTER + EVM_MOUSE_FILTER + EVM_MOUSE + EVM_KEY + EVM_REDRAW + EVM_BUTTON |
5668 | hidnplayr | 212 | |
5670 | hidnplayr | 213 | mcall 66, 1, 1 ; Switch keyboard to scancode mode |
214 | |||
5677 | hidnplayr | 215 | call generate_keymap |
216 | |||
5668 | hidnplayr | 217 | redraw: |
218 | mcall 12, 1 |
||
219 | |||
220 | mov ebx, dword[screen] |
||
221 | movzx ecx, bx |
||
222 | shr ebx, 16 |
||
223 | mov edx, 0x74ffffff |
||
224 | mov edi, name |
||
225 | mcall 0 ; draw window |
||
226 | |||
227 | mcall 12, 2 |
||
228 | |||
5670 | hidnplayr | 229 | draw_framebuffer: |
5720 | hidnplayr | 230 | DEBUGF 1, "Drawing framebuffer\n" |
5722 | hidnplayr | 231 | mcall 7, framebuffer, dword[screen], 0 |
5750 | hidnplayr | 232 | and [work], not WORK_FRAMEBUFFER |
5670 | hidnplayr | 233 | |
3545 | hidnplayr | 234 | mainloop: |
5668 | hidnplayr | 235 | cmp [status], STATUS_CONNECTED |
236 | jne draw_gui |
||
5750 | hidnplayr | 237 | test [work], WORK_FRAMEBUFFER |
238 | jnz draw_framebuffer |
||
239 | test [work], WORK_CURSOR |
||
240 | jnz update_cursor |
||
3545 | hidnplayr | 241 | |
5750 | hidnplayr | 242 | mcall 23, 10 ; Check for event with 0,1s timeout |
5668 | hidnplayr | 243 | |
3545 | hidnplayr | 244 | dec eax |
245 | jz redraw |
||
246 | dec eax |
||
247 | jz key |
||
248 | dec eax |
||
249 | jz button |
||
250 | sub eax, 3 |
||
251 | jz mouse |
||
252 | jmp mainloop |
||
253 | |||
254 | key: |
||
5677 | hidnplayr | 255 | mcall 66, 3 |
5693 | hidnplayr | 256 | mov ebx, eax ; get modifier keys |
5677 | hidnplayr | 257 | |
5693 | hidnplayr | 258 | mcall 2 ; get key scancode |
259 | cmp ah, 224 ; extended keycode? |
||
260 | je .extended |
||
3545 | hidnplayr | 261 | |
5670 | hidnplayr | 262 | xor al, al |
263 | test ah, 0x80 ; key up? |
||
264 | jnz @f |
||
265 | inc al |
||
5755 | hidnplayr | 266 | and ah, 0x7f |
5670 | hidnplayr | 267 | @@: |
268 | mov byte[KeyEvent.down], al |
||
269 | |||
5693 | hidnplayr | 270 | movzx eax, ah |
5670 | hidnplayr | 271 | |
5677 | hidnplayr | 272 | test ebx, 100000b ; alt? |
5693 | hidnplayr | 273 | jz .no_alt |
274 | mov ax, [keymap_alt+eax*2] |
||
5677 | hidnplayr | 275 | jmp .key |
5693 | hidnplayr | 276 | .no_alt: |
277 | |||
5677 | hidnplayr | 278 | test ebx, 11b ; shift? |
5693 | hidnplayr | 279 | jz .no_shift |
280 | mov ax, [keymap_shift+eax*2] |
||
281 | jmp .key |
||
282 | .no_shift: |
||
283 | |||
284 | test ebx, 10000000b ; numlock ? |
||
285 | jz .no_numlock |
||
286 | cmp al, 71 |
||
287 | jb .no_numlock |
||
288 | cmp al, 83 |
||
289 | ja .no_numlock |
||
290 | mov ah, [keymap_numlock+eax-71] |
||
291 | xor al, al |
||
292 | jmp .key |
||
293 | |||
294 | .extended: ; extended keys always use regular keymap |
||
295 | mcall 2 |
||
296 | shr eax, 8 |
||
297 | jz mainloop |
||
5755 | hidnplayr | 298 | |
299 | xor ah, ah |
||
300 | test al, 0x80 ; key up? |
||
301 | jnz @f |
||
302 | inc ah |
||
303 | @@: |
||
304 | mov byte[KeyEvent.down], ah |
||
305 | and ax, 0x007f |
||
5693 | hidnplayr | 306 | .no_numlock: |
307 | mov ax, [keymap+eax*2] |
||
5677 | hidnplayr | 308 | .key: |
5693 | hidnplayr | 309 | test ax, ax |
310 | jz mainloop |
||
5677 | hidnplayr | 311 | mov word[KeyEvent.key+2], ax |
312 | DEBUGF 1, "Sending key: 0x%x\n", ax |
||
5668 | hidnplayr | 313 | mcall send, [socketnum], KeyEvent, 8, 0 |
3545 | hidnplayr | 314 | jmp mainloop |
315 | |||
5677 | hidnplayr | 316 | |
5693 | hidnplayr | 317 | |
3545 | hidnplayr | 318 | mouse: |
5677 | hidnplayr | 319 | ; DEBUGF 1, "Sending pointer event\n" |
3545 | hidnplayr | 320 | |
321 | mcall 37, 1 ; get mouse pos |
||
322 | bswap eax |
||
5668 | hidnplayr | 323 | mov [PointerEvent.x], ax |
3545 | hidnplayr | 324 | shr eax, 16 |
5668 | hidnplayr | 325 | mov [PointerEvent.y], ax |
3545 | hidnplayr | 326 | |
327 | mcall 37, 2 ; get mouse buttons |
||
328 | test al, 00000010b ; test if right button was pressed (bit 1 in kolibri) |
||
329 | jz @f |
||
5663 | hidnplayr | 330 | 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 | 331 | @@: |
5668 | hidnplayr | 332 | mov [PointerEvent.mask], al |
3545 | hidnplayr | 333 | |
5668 | hidnplayr | 334 | mcall send, [socketnum], PointerEvent, 6, 0 |
3545 | hidnplayr | 335 | jmp mainloop |
336 | |||
337 | button: |
||
338 | mcall 17 ; get id |
||
5680 | hidnplayr | 339 | mov [status], STATUS_CLOSED |
5677 | hidnplayr | 340 | mcall close, [socketnum] |
3545 | hidnplayr | 341 | mcall -1 |
342 | |||
343 | |||
5750 | hidnplayr | 344 | update_cursor: |
345 | |||
346 | ; load cursor |
||
347 | mov dx, word[cursor.y] |
||
348 | shl edx, 16 |
||
349 | mov dx, 2 |
||
350 | mcall 37, 4, cursor.image |
||
351 | test eax, eax |
||
352 | jz .fail |
||
353 | |||
354 | ; set cursor |
||
355 | mov ecx, eax |
||
356 | mcall 37, 5 |
||
357 | |||
358 | ; delete previously set cursor |
||
359 | mov ecx, eax |
||
360 | mcall 37, 6 |
||
361 | |||
362 | .fail: |
||
363 | and [work], not WORK_CURSOR |
||
364 | jmp mainloop |
||
365 | |||
366 | |||
5668 | hidnplayr | 367 | ; DATA AREA |
3545 | hidnplayr | 368 | |
5668 | hidnplayr | 369 | include_debug_strings |
3545 | hidnplayr | 370 | |
5693 | hidnplayr | 371 | keymap_numlock: |
372 | db '7', '8', '9', '-' |
||
373 | db '4', '5', '6', '+' |
||
374 | db '1', '2', '3' |
||
375 | db '0', '.' |
||
376 | |||
5668 | hidnplayr | 377 | HandShake db "RFB 003.003", 10 |
3545 | hidnplayr | 378 | |
5668 | hidnplayr | 379 | ClientInit db 0 ; not shared |
3545 | hidnplayr | 380 | |
5750 | hidnplayr | 381 | if BITS_PER_PIXEL = 32 |
382 | |||
383 | SetPixelFormat db 0 ; setPixelformat |
||
5668 | hidnplayr | 384 | db 0, 0, 0 ; padding |
385 | .bpp db 32 ; bits per pixel |
||
5722 | hidnplayr | 386 | .depth db 24 ; depth |
5668 | hidnplayr | 387 | .big_endian db 0 ; big-endian flag |
388 | .true_color db 1 ; true-colour flag |
||
389 | .red_max db 0, 255 ; red-max |
||
390 | .green_max db 0, 255 ; green-max |
||
391 | .blue_max db 0, 255 ; blue-max |
||
5722 | hidnplayr | 392 | .red_shift db 16 ; red-shift |
5668 | hidnplayr | 393 | .green_shift db 8 ; green-shift |
5722 | hidnplayr | 394 | .blue_shift db 0 ; blue-shift |
5668 | hidnplayr | 395 | db 0, 0, 0 ; padding |
3545 | hidnplayr | 396 | |
5750 | hidnplayr | 397 | else if BITS_PER_PIXEL = 24 |
398 | |||
399 | SetPixelFormat db 0 ; setPixelformat |
||
5677 | hidnplayr | 400 | db 0, 0, 0 ; padding |
401 | .bpp db 24 ; bits per pixel |
||
402 | .depth db 24 ; depth |
||
403 | .big_endian db 0 ; big-endian flag |
||
404 | .true_color db 1 ; true-colour flag |
||
405 | .red_max db 0, 255 ; red-max |
||
406 | .green_max db 0, 255 ; green-max |
||
407 | .blue_max db 0, 255 ; blue-max |
||
408 | .red_shift db 16 ; red-shift |
||
409 | .green_shift db 8 ; green-shift |
||
410 | .blue_shift db 0 ; blue-shift |
||
411 | db 0, 0, 0 ; padding |
||
412 | |||
5750 | hidnplayr | 413 | else if BITS_PER_PIXEL = 16 |
414 | |||
415 | SetPixelFormat db 0 ; setPixelformat |
||
5668 | hidnplayr | 416 | db 0, 0, 0 ; padding |
417 | .bpp db 16 ; bits per pixel |
||
5677 | hidnplayr | 418 | .depth db 16 ; depth |
5668 | hidnplayr | 419 | .big_endian db 0 ; big-endian flag |
420 | .true_color db 1 ; true-colour flag |
||
421 | .red_max db 0, 31 ; red-max |
||
5677 | hidnplayr | 422 | .green_max db 0, 63 ; green-max |
5668 | hidnplayr | 423 | .blue_max db 0, 31 ; blue-max |
5677 | hidnplayr | 424 | .red_shift db 11 ; red-shift |
5668 | hidnplayr | 425 | .green_shift db 5 ; green-shift |
5677 | hidnplayr | 426 | .blue_shift db 0 ; blue-shift |
5668 | hidnplayr | 427 | db 0, 0, 0 ; padding |
3545 | hidnplayr | 428 | |
5750 | hidnplayr | 429 | else if BITS_PER_PIXEL = 8 |
430 | |||
431 | SetPixelFormat db 0 ; setPixelformat |
||
5668 | hidnplayr | 432 | db 0, 0, 0 ; padding |
433 | .bpp db 8 ; bits per pixel |
||
5677 | hidnplayr | 434 | .depth db 8 ; depth |
5668 | hidnplayr | 435 | .big_endian db 0 ; big-endian flag |
436 | .true_color db 1 ; true-colour flag |
||
5677 | hidnplayr | 437 | .red_max db 0, 7 ; red-max |
438 | .green_max db 0, 7 ; green-max |
||
5668 | hidnplayr | 439 | .blue_max db 0, 3 ; blue-max |
5750 | hidnplayr | 440 | .red_shift db 5 ; red-shift |
441 | .green_shift db 2 ; green-shift |
||
442 | .blue_shift db 0 ; blue-shift |
||
5668 | hidnplayr | 443 | db 0, 0, 0 ; padding |
3545 | hidnplayr | 444 | |
5750 | hidnplayr | 445 | end if |
446 | |||
5668 | hidnplayr | 447 | SetEncodings db 2 ; setEncodings |
448 | db 0 ; padding |
||
5750 | hidnplayr | 449 | db 0, 5 ; number of encodings |
5720 | hidnplayr | 450 | ; db 0, 0, 0, 16 ; ZRLE |
451 | db 0, 0, 0, 15 ; TRLE |
||
452 | db 0, 0, 0, 2 ; RRE |
||
5668 | hidnplayr | 453 | db 0, 0, 0, 1 ; Copyrect encoding |
5750 | hidnplayr | 454 | db 0xff, 0xff, 0xff, 0x11 ; Cursor pseudo encoding |
5715 | hidnplayr | 455 | db 0, 0, 0, 0 ; raw encoding |
5708 | hidnplayr | 456 | .length = $ - SetEncodings |
3545 | hidnplayr | 457 | |
5668 | hidnplayr | 458 | FramebufferUpdateRequest db 3 |
459 | .inc db 0 ; incremental |
||
460 | .x dw 0 |
||
461 | .y dw 0 |
||
462 | .width dw 0 |
||
463 | .height dw 0 |
||
3545 | hidnplayr | 464 | |
5668 | hidnplayr | 465 | KeyEvent db 4 ; keyevent |
466 | .down db 0 ; down-flag |
||
467 | dw 0 ; padding |
||
468 | .key dd 0 ; key |
||
3545 | hidnplayr | 469 | |
5668 | hidnplayr | 470 | PointerEvent db 5 ; pointerevent |
471 | .mask db 0 ; button-mask |
||
472 | .x dw 0 ; x-position |
||
473 | .y dw 0 ; y-position |
||
3545 | hidnplayr | 474 | |
475 | |||
476 | sockaddr1: |
||
5668 | hidnplayr | 477 | dw AF_INET4 |
478 | .port dw 0x0c17 ; 5900 |
||
479 | .ip dd 0 |
||
480 | rb 10 |
||
3545 | hidnplayr | 481 | |
5668 | hidnplayr | 482 | beep db 0x85, 0x25, 0x85, 0x40, 0 |
5663 | hidnplayr | 483 | |
5720 | hidnplayr | 484 | status dd STATUS_CONNECT |
5750 | hidnplayr | 485 | work dd 0 |
5670 | hidnplayr | 486 | mouse_dd dd 0 |
5720 | hidnplayr | 487 | thread_id dd 0 |
5668 | hidnplayr | 488 | |
5717 | hidnplayr | 489 | deflate_buffer dd 0 |
490 | deflate_length dd ? |
||
491 | deflate_str dd ? |
||
492 | |||
7017 | leency | 493 | URLbox edit_box 235, 70, 20, 0xffffff, 0x6f9480, 0, 0, 0x90000000, SERVERADDRLEN, serveraddr, mouse_dd, ed_focus, 0, 0 |
494 | USERbox edit_box 215, 90, 10, 0xffffff, 0x6f9480, 0, 0, 0x90000000, 127, username, mouse_dd, ed_focus, 0, 0 |
||
495 | PASSbox edit_box 215, 90, 35, 0xffffff, 0x6f9480, 0, 0, 0x10000000, 127, password, mouse_dd, ed_pass, 0, 0 |
||
5663 | hidnplayr | 496 | |
5668 | hidnplayr | 497 | serverstr db "server:" |
498 | userstr db "username:" |
||
499 | passstr db "password:" |
||
5670 | hidnplayr | 500 | connectstr db "Connect" |
501 | loginstr db "Log in" |
||
5720 | hidnplayr | 502 | cancelstr db "Cancel" |
503 | okstr db "OK" |
||
504 | okstr_e: |
||
5668 | hidnplayr | 505 | |
5720 | hidnplayr | 506 | sz_err_disconnected db "The server has closed the connection unexpectedly.", 0 |
5668 | hidnplayr | 507 | sz_err_dns db "Could not resolve hostname.", 0 |
508 | sz_err_sock db "Could not open socket.", 0 |
||
509 | sz_err_connect db "Could not connect to the server.", 0 |
||
510 | sz_err_proto db "A protocol error has occured.", 0 |
||
5720 | hidnplayr | 511 | sz_err_security db "An authentication problem has occured.", 0 |
5668 | hidnplayr | 512 | sz_err_library db "Could not load needed libraries.", 0 |
513 | sz_err_thread db "Could not create thread.", 0 |
||
5680 | hidnplayr | 514 | sz_err_login_failed db "Login failed.", 0 |
5668 | hidnplayr | 515 | |
516 | err_msg dd sz_err_disconnected |
||
517 | dd sz_err_dns |
||
518 | dd sz_err_sock |
||
519 | dd sz_err_connect |
||
520 | dd sz_err_proto |
||
521 | dd sz_err_security |
||
522 | dd sz_err_library |
||
523 | dd sz_err_thread |
||
5680 | hidnplayr | 524 | dd sz_err_login_failed |
5720 | hidnplayr | 525 | dd sz_err_security_c |
5668 | hidnplayr | 526 | |
3545 | hidnplayr | 527 | ; import |
528 | align 4 |
||
529 | @IMPORT: |
||
530 | |||
5663 | hidnplayr | 531 | library network, "network.obj",\ |
532 | box_lib, "box_lib.obj",\ |
||
533 | archiver, "archiver.obj" |
||
3545 | hidnplayr | 534 | |
5663 | hidnplayr | 535 | import network,\ |
536 | getaddrinfo, "getaddrinfo", \ |
||
537 | freeaddrinfo, "freeaddrinfo", \ |
||
538 | inet_ntoa, "inet_ntoa" |
||
3545 | hidnplayr | 539 | |
5663 | hidnplayr | 540 | import box_lib,\ |
541 | edit_box_draw, "edit_box",\ |
||
542 | edit_box_key, "edit_box_key",\ |
||
543 | edit_box_mouse, "edit_box_mouse",\ |
||
544 | scrollbar_v_draw, "scrollbar_v_draw",\ |
||
545 | scrollbar_v_mouse, "scrollbar_v_mouse",\ |
||
546 | scrollbar_h_draw, "scrollbar_h_draw",\ |
||
547 | scrollbar_h_mouse, "scrollbar_h_mouse" |
||
548 | |||
549 | import archiver,\ |
||
5717 | hidnplayr | 550 | deflate_unpack2, "deflate_unpack2" |
5663 | hidnplayr | 551 | |
5668 | hidnplayr | 552 | name db "VNC viewer " |
553 | .dash db 0, " " |
||
5663 | hidnplayr | 554 | |
3545 | hidnplayr | 555 | I_END: |
556 | |||
5663 | hidnplayr | 557 | servername rb 64+1 |
3545 | hidnplayr | 558 | |
5720 | hidnplayr | 559 | serveraddr db 0 |
560 | rb SERVERADDRLEN |
||
561 | |||
5663 | hidnplayr | 562 | socketnum dd ? |
563 | datapointer dd ? |
||
5668 | hidnplayr | 564 | |
5663 | hidnplayr | 565 | rectangles dw ? |
3545 | hidnplayr | 566 | |
5663 | hidnplayr | 567 | rectangle: |
5668 | hidnplayr | 568 | .x dd ? |
569 | .y dd ? |
||
570 | .width dd ? |
||
571 | .height dd ? |
||
3545 | hidnplayr | 572 | |
5668 | hidnplayr | 573 | subrectangles dd ? |
574 | |||
575 | subrectangle: |
||
576 | .x dd ? |
||
577 | .y dd ? |
||
578 | .width dd ? |
||
579 | .height dd ? |
||
580 | |||
5663 | hidnplayr | 581 | screen: ; Remote screen resolution |
582 | .height dw ? |
||
583 | .width dw ? |
||
3545 | hidnplayr | 584 | |
5716 | hidnplayr | 585 | palette rd 128 ; TRLE/ZRLE |
586 | palettesize db ? ; TRLE/ZRLE |
||
587 | |||
5677 | hidnplayr | 588 | keymap rw 128 |
589 | keymap_shift rw 128 |
||
590 | keymap_alt rw 128 |
||
5670 | hidnplayr | 591 | username rb 128 |
592 | password rb 128 |
||
5750 | hidnplayr | 593 | keys rd 32*2 ; DES keys for VNC authentication |
5680 | hidnplayr | 594 | |
5750 | hidnplayr | 595 | cursor: |
596 | .y db ? |
||
597 | .x db ? |
||
598 | .image rd 32*32 |
||
599 | |||
600 | align 4 |
||
601 | if BITS_PER_PIXEL = 8 |
||
602 | lut_8bpp rd 256 |
||
603 | end if |
||
604 | |||
5720 | hidnplayr | 605 | sz_err_security_c rb 512+1 |
606 | |||
5668 | hidnplayr | 607 | receive_buffer rb RECEIVE_BUFFER_SIZE |
5722 | hidnplayr | 608 | framebuffer rb 1280*1024*3 ; framebuffer |
3545 | hidnplayr | 609 | |
5663 | hidnplayr | 610 | rb 0x1000 |
3545 | hidnplayr | 611 | thread_stack: |
5663 | hidnplayr | 612 | rb 0x1000 |
3545 | hidnplayr | 613 | IM_END: |
614 |