forked from KolibriOS/kolibrios
VNC client: small bugfixes, use text box from box_lib, refactoring.
git-svn-id: svn://kolibrios.org@5663 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
65fb1ce67e
commit
1fbde44c02
@ -1,257 +1,135 @@
|
|||||||
red_logon:
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
call draw_window_logon ; at first, draw the window
|
;; ;;
|
||||||
|
;; Copyright (C) KolibriOS team 2010-2015. All rights reserved. ;;
|
||||||
|
;; Distributed under terms of the GNU General Public License ;;
|
||||||
|
;; ;;
|
||||||
|
;; VNC client for KolibriOS ;;
|
||||||
|
;; ;;
|
||||||
|
;; Written by hidnplayr@kolibrios.org ;;
|
||||||
|
;; ;;
|
||||||
|
;; GNU GENERAL PUBLIC LICENSE ;;
|
||||||
|
;; Version 2, June 1991 ;;
|
||||||
|
;; ;;
|
||||||
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
still_logon: ; main cycle of application begins here
|
logon:
|
||||||
mov eax,10 ; wait here for event
|
mcall 40, EVM_MOUSE + EVM_MOUSE_FILTER + EVM_REDRAW + EVM_BUTTON + EVM_KEY
|
||||||
mcall
|
|
||||||
|
|
||||||
checkevent_logon: ; Check what event was called _logon: this will be used to return from textbox focus
|
.redraw:
|
||||||
|
mcall 12, 1 ; start window draw
|
||||||
|
pusha
|
||||||
|
; DRAW WINDOW
|
||||||
|
xor eax, eax ; function 0 _logon: define and draw window
|
||||||
|
mov ebx, 160 shl 16 + 330 ; [x start]:[x size]
|
||||||
|
mov ecx, 160 shl 16 + 100 ; [y start]:[y size]
|
||||||
|
mov edx, 0x34DDDDDD ; color of work area RRGGBB
|
||||||
|
mov edi, name ; WINDOW LABEL
|
||||||
|
mcall
|
||||||
|
|
||||||
dec eax ; redraw request ?
|
mov eax, 8 ; LOGON BUTTON
|
||||||
jz red_logon
|
mov ebx, 220 shl 16 + 85
|
||||||
dec eax ; key in buffer ?
|
mov ecx, 47 shl 16 + 16
|
||||||
jz key_logon
|
mov edx, 2
|
||||||
dec eax ; button in buffer ?
|
mov esi, 0xCCCCCC
|
||||||
jz button_logon
|
mcall
|
||||||
|
|
||||||
jmp still_logon
|
cmp byte[mode], 0
|
||||||
|
je .servermode
|
||||||
|
|
||||||
key_logon: ; key event handler
|
mov eax, 4 ; function 4 write text to window
|
||||||
mov al,2 ; eax was zero so will now be 2
|
mov ebx, 25 shl 16 + 15 ; [x start]:[y start]
|
||||||
mcall ; just read it and ignore
|
xor ecx, ecx
|
||||||
|
mov edx, userstr ; pointer to text beginning
|
||||||
|
mov esi, passstr-userstr ; text length
|
||||||
|
mcall
|
||||||
|
|
||||||
cmp ah,13
|
add bl, 19
|
||||||
jne still_logon ; return to main loop
|
mov edx, passstr ; pointer to text beginning
|
||||||
|
mov esi, connectstr-passstr ; text length
|
||||||
|
mcall
|
||||||
|
|
||||||
ret ; enter key was pressed => return to logon
|
jmp .drawtherest
|
||||||
|
|
||||||
button_logon: ; eax was zero so will now be 17
|
.servermode:
|
||||||
mov al,17 ; get id
|
mov eax, 4 ; function 4 write text to window
|
||||||
mcall
|
mov ebx, 25 shl 16 + 15 ; [x start] *65536 + [y start]
|
||||||
|
xor ecx, ecx
|
||||||
|
mov edx, serverstr ; pointer to text beginning
|
||||||
|
mov esi, userstr-serverstr ; text length
|
||||||
|
mcall
|
||||||
|
|
||||||
cmp ah,1 ; close ?
|
invoke edit_box_draw, URLbox
|
||||||
jz close_logon
|
|
||||||
cmp ah,2 ; logon ?
|
|
||||||
je connect_logon
|
|
||||||
cmp ah,5 ; first ?
|
|
||||||
jz dstbtn_logon
|
|
||||||
|
|
||||||
srcbtn_logon:
|
.drawtherest:
|
||||||
mov dword[addr],first
|
mov ebx, 240 shl 16 + 49 ; [x start] *65536 + [y start]
|
||||||
jmp rk_logon
|
mov edx, connectstr ; pointer to text beginning
|
||||||
|
mov esi, connect_e-connectstr ; text length
|
||||||
|
mcall
|
||||||
|
|
||||||
dstbtn_logon:
|
popa
|
||||||
mov dword[addr],second
|
inc ebx
|
||||||
|
mcall
|
||||||
|
|
||||||
rk_logon:
|
.loop:
|
||||||
mov edi,[addr] ; load the address of the string
|
mcall 10 ; wait for event
|
||||||
xor al,al ; mov al,0 ; the symbol we will search for
|
dec eax ; redraw request ?
|
||||||
mov ecx,STRLEN+1 ; length of the string (+1)
|
jz .redraw
|
||||||
cld ; search forward
|
dec eax ; key in buffer ?
|
||||||
repne scasb ; do search now
|
jz .key
|
||||||
inc ecx ; we've found a zero or ecx became 0
|
dec eax ; button in buffer ?
|
||||||
mov eax,STRLEN+1
|
jz .btn
|
||||||
sub eax,ecx ; eax = address of <0> character
|
sub eax, 3
|
||||||
mov [temp],eax ; position
|
jz .mouse
|
||||||
|
jmp .loop
|
||||||
|
|
||||||
cmp dword[addr],dword second
|
.key: ; key event handler
|
||||||
jne @f
|
mcall 2 ; read key
|
||||||
mov dword [passlen],eax
|
|
||||||
@@:
|
|
||||||
|
|
||||||
call print_text_logon
|
test [URLbox.flags], ed_focus
|
||||||
|
jz mainloop
|
||||||
|
cmp ah, 13 ; enter (return) key
|
||||||
|
je .go
|
||||||
|
invoke edit_box_key, URLbox
|
||||||
|
jmp .loop
|
||||||
|
|
||||||
mov edi,[addr] ; address of string
|
.go:
|
||||||
add edi,[temp] ; cursor position
|
mov eax, [URLbox.pos]
|
||||||
|
mov byte[serveraddr+eax], 0
|
||||||
|
ret
|
||||||
|
|
||||||
.waitev_logon:
|
.btn:
|
||||||
mov eax,10 ; wait for event
|
mcall 17 ; get id
|
||||||
mcall
|
|
||||||
cmp eax,2 ; button presed ?
|
|
||||||
jne checkevent_logon ; a key is pressed or redraw is nessesary, goto checkevent
|
|
||||||
mcall ; eax = 2, read button
|
|
||||||
shr eax,8
|
|
||||||
cmp eax,8
|
|
||||||
jnz .nobs_logon ; BACKSPACE
|
|
||||||
cmp edi,[addr]
|
|
||||||
jz .waitev_logon
|
|
||||||
dec edi
|
|
||||||
mov byte[edi],0
|
|
||||||
|
|
||||||
cmp dword[addr],second
|
cmp ah, 1 ; close ?
|
||||||
jne @f
|
jz .close
|
||||||
dec [passlen]
|
cmp ah, 2 ; logon ?
|
||||||
@@:
|
je .go
|
||||||
|
|
||||||
call print_text_logon
|
jmp .loop
|
||||||
jmp .waitev_logon
|
|
||||||
.nobs_logon:
|
|
||||||
cmp eax,13 ; ENTER
|
|
||||||
je still_logon
|
|
||||||
cmp eax,192
|
|
||||||
jne .noclear_logon
|
|
||||||
xor al,al
|
|
||||||
mov edi,[addr]
|
|
||||||
mov ecx,STRLEN
|
|
||||||
rep stosb
|
|
||||||
mov edi,[addr]
|
|
||||||
call print_text_logon
|
|
||||||
jmp .waitev_logon
|
|
||||||
|
|
||||||
.noclear_logon:
|
.mouse:
|
||||||
mov [edi],al
|
mcall 23
|
||||||
|
invoke edit_box_mouse, URLbox
|
||||||
|
|
||||||
cmp dword[addr],second
|
jmp .loop
|
||||||
jne @f
|
|
||||||
inc [passlen]
|
|
||||||
@@:
|
|
||||||
|
|
||||||
call print_text_logon
|
.close:
|
||||||
|
mcall -1
|
||||||
inc edi
|
|
||||||
mov esi,[addr]
|
|
||||||
add esi,STRLEN
|
|
||||||
cmp esi,edi
|
|
||||||
jnz .waitev_logon
|
|
||||||
|
|
||||||
jmp still_logon
|
|
||||||
|
|
||||||
|
|
||||||
; print strings (source & destination)
|
|
||||||
print_text_logon:
|
|
||||||
pusha
|
|
||||||
|
|
||||||
mov eax, 8
|
|
||||||
mov ebx, 105*65536+200
|
|
||||||
mov ecx, 31*65536+13
|
|
||||||
mov edx, 4
|
|
||||||
mov esi, 0xEBEBEB
|
|
||||||
mcall
|
|
||||||
|
|
||||||
cmp byte[mode],0
|
|
||||||
je @f
|
|
||||||
|
|
||||||
mov ecx, 49*65536+12
|
|
||||||
inc edx
|
|
||||||
mcall
|
|
||||||
|
|
||||||
@@:
|
|
||||||
mov eax, 4 ; function 4 _logon: write text to window
|
|
||||||
mov ebx, 107*65536+34 ; [x start] *65536 + [y start]
|
|
||||||
xor ecx, ecx ; color of text RRGGBB
|
|
||||||
mov edx, first ; pointer to text beginning
|
|
||||||
mov esi, STRLEN ; text length
|
|
||||||
mcall
|
|
||||||
|
|
||||||
cmp byte[mode],0
|
|
||||||
je dont_draw_pass
|
|
||||||
|
|
||||||
add ebx,16
|
|
||||||
mov edi,[passlen]
|
|
||||||
|
|
||||||
@@:
|
|
||||||
cmp edi,0
|
|
||||||
jle dont_draw_pass
|
|
||||||
|
|
||||||
dec edi
|
|
||||||
mov edx, passchar
|
|
||||||
mov esi, 1
|
|
||||||
mcall
|
|
||||||
add ebx,6*65536
|
|
||||||
jmp @r
|
|
||||||
|
|
||||||
dont_draw_pass:
|
|
||||||
|
|
||||||
popa
|
|
||||||
ret
|
|
||||||
|
|
||||||
close_logon:
|
|
||||||
or eax,-1
|
|
||||||
mcall
|
|
||||||
|
|
||||||
connect_logon:
|
|
||||||
ret
|
|
||||||
|
|
||||||
draw_window_logon:
|
|
||||||
|
|
||||||
mcall 12, 1 ; start window draw
|
|
||||||
pusha
|
|
||||||
; DRAW WINDOW
|
|
||||||
xor eax, eax ; function 0 _logon: define and draw window
|
|
||||||
mov ebx, 160*65536+330 ; [x start] *65536 + [x size]
|
|
||||||
mov ecx, 160*65536+100 ; [y start] *65536 + [y size]
|
|
||||||
mov edx, 0x13DDDDDD ; color of work area RRGGBB
|
|
||||||
mov edi, title ; WINDOW LABEL
|
|
||||||
mcall
|
|
||||||
|
|
||||||
mov eax, 8 ; LOGON BUTTON
|
|
||||||
mov ebx, 220*65536+85
|
|
||||||
mov ecx, 63*65536+16
|
|
||||||
mov edx, 2
|
|
||||||
mov esi, 0xCCCCCC
|
|
||||||
mcall
|
|
||||||
|
|
||||||
|
|
||||||
call print_text_logon
|
|
||||||
|
|
||||||
cmp byte[mode], 0
|
|
||||||
je servermode_
|
|
||||||
|
|
||||||
mov eax, 4 ; function 4 write text to window
|
|
||||||
mov ebx, 25*65536+33 ; [x start] *65536 + [y start]
|
|
||||||
xor ecx, ecx
|
|
||||||
mov edx, userstr ; pointer to text beginning
|
|
||||||
mov esi, passstr-userstr ; text length
|
|
||||||
mcall
|
|
||||||
|
|
||||||
add bl,19
|
|
||||||
mov edx, passstr ; pointer to text beginning
|
|
||||||
mov esi, connectstr-passstr ; text length
|
|
||||||
mcall
|
|
||||||
|
|
||||||
jmp drawtherest_
|
|
||||||
|
|
||||||
servermode_:
|
|
||||||
|
|
||||||
mov eax, 4 ; function 4 write text to window
|
|
||||||
mov ebx, 25*65536+33 ; [x start] *65536 + [y start]
|
|
||||||
xor ecx, ecx
|
|
||||||
mov edx, serverstr ; pointer to text beginning
|
|
||||||
mov esi, userstr-serverstr ; text length
|
|
||||||
mcall
|
|
||||||
|
|
||||||
drawtherest_:
|
|
||||||
|
|
||||||
mov ebx, 240*65536+67 ; [x start] *65536 + [y start]
|
|
||||||
mov edx, connectstr ; pointer to text beginning
|
|
||||||
mov esi, connect_e-connectstr ; text length
|
|
||||||
mcall
|
|
||||||
|
|
||||||
popa
|
|
||||||
inc ebx
|
|
||||||
mcall
|
|
||||||
|
|
||||||
ret
|
|
||||||
|
|
||||||
|
|
||||||
; DATA AREA
|
; DATA AREA
|
||||||
title db 'Kolibrios VNC client by HIDNPLAYR',0
|
|
||||||
|
|
||||||
first: db '192.168.1.5'
|
passchar db "*"
|
||||||
rb STRLEN
|
|
||||||
second: rb STRLEN
|
|
||||||
|
|
||||||
passchar db '*'
|
|
||||||
passlen dd 0
|
passlen dd 0
|
||||||
|
|
||||||
addr dd 0
|
addr dd 0
|
||||||
temp dd 0
|
temp dd 0
|
||||||
mode db 0 ; 0 = connection details, 1 = authentication
|
mode db 0 ; 0 = connection details, 1 = authentication
|
||||||
|
|
||||||
serverstr: db 'server:'
|
serverstr db "server:"
|
||||||
userstr: db 'username:'
|
userstr db "username:"
|
||||||
passstr: db 'password:'
|
passstr db "password:"
|
||||||
connectstr: db 'connect !'
|
connectstr db "connect !"
|
||||||
connect_e:
|
connect_e:
|
||||||
|
|
||||||
I_END_logon:
|
I_END_logon:
|
||||||
|
@ -1,153 +1,78 @@
|
|||||||
encoding_raw:
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
DEBUGF 1,'RAW\n'
|
;; ;;
|
||||||
|
;; Copyright (C) KolibriOS team 2010-2015. All rights reserved. ;;
|
||||||
|
;; Distributed under terms of the GNU General Public License ;;
|
||||||
|
;; ;;
|
||||||
|
;; VNC client for KolibriOS ;;
|
||||||
|
;; ;;
|
||||||
|
;; Written by hidnplayr@kolibrios.org ;;
|
||||||
|
;; ;;
|
||||||
|
;; GNU GENERAL PUBLIC LICENSE ;;
|
||||||
|
;; Version 2, June 1991 ;;
|
||||||
|
;; ;;
|
||||||
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
mov ax,[frame.y] ;
|
encoding_raw:
|
||||||
mov bx,[screen.width] ;
|
|
||||||
mul bx ;
|
|
||||||
shl edx,16 ;
|
|
||||||
mov dx,ax ; [screen.width]*[frame.y]
|
|
||||||
movzx eax,[frame.x]
|
|
||||||
add edx,eax ; [screen.width]*[frame.y]+[frame.x]
|
|
||||||
|
|
||||||
mov eax,3 ;
|
DEBUGF 1,"RAW\n"
|
||||||
mul edx ; ([screen.width]*[frame.y]+[frame.x])*3
|
|
||||||
|
|
||||||
add eax,framebuffer_data ;
|
movzx eax, [rectangle.width]
|
||||||
push eax ; framebuffer_data+([screen.width]*[frame.y]+[frame.x])*3
|
movzx ebx, [rectangle.height]
|
||||||
|
mul ebx
|
||||||
|
add eax, esi
|
||||||
|
@@:
|
||||||
|
cmp [datapointer], eax
|
||||||
|
jae @f
|
||||||
|
push eax
|
||||||
|
call read_data.more
|
||||||
|
pop eax
|
||||||
|
jmp @b
|
||||||
|
@@:
|
||||||
|
|
||||||
mov ax,[frame.width] ;
|
movzx eax, [rectangle.y]
|
||||||
mov bx,3 ;
|
movzx ebx, [screen.width]
|
||||||
mul bx ;
|
mul ebx ; [screen.width]*[rectangle.y]
|
||||||
shl edx,16 ;
|
movzx ebx, [rectangle.x]
|
||||||
mov dx,ax ; [frame.width]*3
|
add eax, ebx ; [screen.width]*[rectangle.y]+[rectangle.x]
|
||||||
|
lea edi, [framebuffer_data+eax*3] ; edi = framebuffer_data+([screen.width]*[rectangle.y]+[rectangle.x])*3
|
||||||
|
|
||||||
pop eax ;
|
movzx eax, [screen.width]
|
||||||
add edx,eax ; framebuffer_data+([screen.width]*[frame.y]+[frame.x])*3+[frame.width]*3
|
sub ax, [rectangle.width]
|
||||||
push eax ;
|
lea ebp, [eax*3] ; ebp = ([screen.width]-[rectangle.width])*3
|
||||||
push edx ;
|
|
||||||
|
|
||||||
mov ax,[frame.height] ;
|
mov bl, 85
|
||||||
dec ax ;
|
|
||||||
mov bx,3 ;
|
|
||||||
mul bx ;
|
|
||||||
mov bx,[screen.width] ;
|
|
||||||
mul bx ;
|
|
||||||
shl edx,16 ;
|
|
||||||
mov dx,ax ;
|
|
||||||
mov ecx,edx ;
|
|
||||||
pop edx ;
|
|
||||||
add ecx,edx ; mov ecx,edx+([frame.height]-1)*[screen.width]*3
|
|
||||||
pop ebx
|
|
||||||
|
|
||||||
.pixelloop32:
|
movzx edx, [rectangle.height]
|
||||||
cmp ebx,ecx
|
|
||||||
jge next_rectangle
|
|
||||||
|
|
||||||
; add esi,2 ; 32 bit code RAW - OK
|
.lineloop:
|
||||||
; mov al,[esi] ;
|
movzx ecx, [rectangle.width]
|
||||||
; mov [ebx],al ;
|
|
||||||
; inc ebx ;
|
|
||||||
; dec esi ;
|
|
||||||
; ;
|
|
||||||
; mov al,[esi] ;
|
|
||||||
; mov [ebx],al ;
|
|
||||||
; inc ebx ;
|
|
||||||
; dec esi ;
|
|
||||||
; ;
|
|
||||||
; mov al,[esi] ;
|
|
||||||
; mov [ebx],al ;
|
|
||||||
; inc ebx ;
|
|
||||||
; add esi,4 ;
|
|
||||||
|
|
||||||
; push ecx ; 16 bit code RAW
|
.pixelloop:
|
||||||
; mov cl,51
|
mov al, [esi]
|
||||||
;
|
shr al, 4
|
||||||
; mov ax,[esi] ;
|
and al, 3
|
||||||
; xchg al,ah
|
mul bl
|
||||||
; and al,00011111b ;
|
stosb
|
||||||
; xchg al,ah
|
|
||||||
; mul cl
|
|
||||||
; mov [ebx],al ;
|
|
||||||
; inc ebx ;
|
|
||||||
;
|
|
||||||
; mov ax,[esi] ;
|
|
||||||
; xchg al,ah
|
|
||||||
; shr ax,5 ;
|
|
||||||
; xchg al,ah
|
|
||||||
; and al,00011111b ;
|
|
||||||
; mul cl
|
|
||||||
; mov [ebx],al ;
|
|
||||||
; inc ebx ;
|
|
||||||
;
|
|
||||||
; mov ax,[esi] ;
|
|
||||||
; xchg al,ah
|
|
||||||
; shr ax,10 ;
|
|
||||||
; and al,00011111b ;
|
|
||||||
; mul cl
|
|
||||||
; mov [ebx],al ;
|
|
||||||
; inc ebx ;
|
|
||||||
;
|
|
||||||
; inc esi ;
|
|
||||||
; inc esi ;
|
|
||||||
; pop ecx
|
|
||||||
|
|
||||||
push ecx ; 8 bit code RAW - OK
|
mov al, [esi]
|
||||||
mov cl,85 ;
|
shr al, 2
|
||||||
;
|
and al, 3
|
||||||
mov al,[esi] ;
|
mul bl
|
||||||
shr al,4 ;
|
stosb
|
||||||
and al,3 ;
|
|
||||||
mul cl ;
|
|
||||||
mov [ebx],al ;
|
|
||||||
inc ebx ;
|
|
||||||
;
|
|
||||||
mov al,[esi] ;
|
|
||||||
shr al,2 ;
|
|
||||||
and al,3 ;
|
|
||||||
mul cl ;
|
|
||||||
mov [ebx],al ;
|
|
||||||
inc ebx ;
|
|
||||||
;
|
|
||||||
mov al,[esi] ;
|
|
||||||
and al,3 ;
|
|
||||||
mul cl ;
|
|
||||||
mov byte[ebx],al ;
|
|
||||||
inc ebx ;
|
|
||||||
inc esi ;
|
|
||||||
pop ecx ;
|
|
||||||
|
|
||||||
|
mov al, [esi]
|
||||||
|
and al, 3
|
||||||
|
mul bl
|
||||||
|
stosb
|
||||||
|
|
||||||
cmp ebx,edx
|
inc esi
|
||||||
jl .pixelloop32
|
dec ecx
|
||||||
|
jnz .pixelloop
|
||||||
|
|
||||||
push edx
|
add edi, ebp
|
||||||
push ebx
|
dec edx
|
||||||
mov ax,[screen.width]
|
jnz .lineloop
|
||||||
mov bx,3
|
jmp next_rectangle
|
||||||
mul bx
|
|
||||||
shl edx,16
|
|
||||||
mov dx,ax
|
|
||||||
mov eax,edx
|
|
||||||
pop ebx
|
|
||||||
pop edx
|
|
||||||
|
|
||||||
add ebx,eax ; eax = [screen.width]*3
|
|
||||||
add edx,eax
|
|
||||||
|
|
||||||
push edx
|
|
||||||
push ebx
|
|
||||||
mov ax,[frame.width]
|
|
||||||
mov bx,3
|
|
||||||
mul bx
|
|
||||||
shl edx,16
|
|
||||||
mov dx,ax
|
|
||||||
mov eax,edx
|
|
||||||
pop ebx
|
|
||||||
pop edx
|
|
||||||
|
|
||||||
sub ebx,eax ; eax = [frame.width]*3
|
|
||||||
|
|
||||||
jmp .pixelloop32
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,22 +0,0 @@
|
|||||||
|
|
||||||
struct pixel_format
|
|
||||||
bpp db ?
|
|
||||||
depth db ?
|
|
||||||
big_endian db ?
|
|
||||||
true_color db ?
|
|
||||||
red_max dw ?
|
|
||||||
green_max dw ?
|
|
||||||
blue_max dw ?
|
|
||||||
red_shift db ?
|
|
||||||
green_shift db ?
|
|
||||||
blue_shift db ?
|
|
||||||
padding rb 3
|
|
||||||
ends
|
|
||||||
|
|
||||||
struct framebuffer
|
|
||||||
width dw ?
|
|
||||||
height dw ?
|
|
||||||
pixelformat pixel_format
|
|
||||||
name_length dd ?
|
|
||||||
name rb 256
|
|
||||||
ends
|
|
@ -1,13 +1,26 @@
|
|||||||
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
;; ;;
|
||||||
|
;; Copyright (C) KolibriOS team 2010-2015. All rights reserved. ;;
|
||||||
|
;; Distributed under terms of the GNU General Public License ;;
|
||||||
|
;; ;;
|
||||||
|
;; VNC client for KolibriOS ;;
|
||||||
|
;; ;;
|
||||||
|
;; Written by hidnplayr@kolibrios.org ;;
|
||||||
|
;; ;;
|
||||||
|
;; GNU GENERAL PUBLIC LICENSE ;;
|
||||||
|
;; Version 2, June 1991 ;;
|
||||||
|
;; ;;
|
||||||
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
thread_start:
|
thread_start:
|
||||||
|
|
||||||
DEBUGF 1, 'I am the thread!\n'
|
DEBUGF 1, "I am the thread!\n"
|
||||||
|
|
||||||
mcall 40, 0
|
mcall 40, 0 ; disable all events
|
||||||
|
|
||||||
; resolve name
|
; resolve name
|
||||||
push esp ; reserve stack place
|
push esp ; reserve stack place
|
||||||
invoke getaddrinfo, first, 0, 0, esp
|
invoke getaddrinfo, serveraddr, 0, 0, esp
|
||||||
pop esi
|
pop esi
|
||||||
; test for error
|
; test for error
|
||||||
test eax, eax
|
test eax, eax
|
||||||
@ -17,215 +30,245 @@ thread_start:
|
|||||||
mov eax, [eax+sockaddr_in.sin_addr]
|
mov eax, [eax+sockaddr_in.sin_addr]
|
||||||
mov [sockaddr1.ip], eax
|
mov [sockaddr1.ip], eax
|
||||||
|
|
||||||
; DEBUGF 1, 'Connecting to %u.%u.%u.%u:%u\n', \
|
DEBUGF 1, "Connecting to %u.%u.%u.%u:%u\n", \
|
||||||
; [server_ip]:1, [server_ip+1]:1, \
|
[sockaddr1.ip]:1, [sockaddr1.ip+1]:1, \
|
||||||
; [server_ip+2]:1, [server_ip+3]:1, \
|
[sockaddr1.ip+2]:1, [sockaddr1.ip+3]:1, \
|
||||||
; [server_port]:2
|
[sockaddr1.port]:2
|
||||||
|
|
||||||
mcall socket, AF_INET4, SOCK_STREAM, 0
|
mcall socket, AF_INET4, SOCK_STREAM, 0
|
||||||
|
test eax, eax
|
||||||
|
jz exit
|
||||||
|
;;; invoke freeaddrinfo, ??
|
||||||
mov [socketnum], eax
|
mov [socketnum], eax
|
||||||
mcall connect, [socketnum], sockaddr1, 18
|
mcall connect, [socketnum], sockaddr1, 18
|
||||||
|
;;; test eax, eax
|
||||||
|
|
||||||
|
; TODO: implement timeout
|
||||||
call wait_for_data
|
call wait_for_data
|
||||||
|
|
||||||
cmp dword [receive_buffer], 'RFB '
|
cmp dword[receive_buffer], "RFB "
|
||||||
jne no_rfb
|
jne no_rfb
|
||||||
DEBUGF 1, 'received: %s\n', receive_buffer
|
DEBUGF 1, "received: %s\n", receive_buffer
|
||||||
mcall send, [socketnum], handshake, 12, 0
|
mcall send, [socketnum], handshake, 12, 0
|
||||||
DEBUGF 1, 'Sending handshake: protocol version\n'
|
DEBUGF 1, "Sending handshake: protocol version\n"
|
||||||
|
|
||||||
call wait_for_data
|
call wait_for_data
|
||||||
|
|
||||||
cmp dword [receive_buffer], 0x00000000
|
cmp dword[receive_buffer], 0x00000000
|
||||||
je invalid_security
|
je invalid_security
|
||||||
|
|
||||||
cmp dword [receive_buffer], 0x01000000
|
cmp dword[receive_buffer], 0x01000000
|
||||||
je no_security
|
je no_security
|
||||||
|
|
||||||
cmp dword [receive_buffer], 0x02000000
|
cmp dword[receive_buffer], 0x02000000
|
||||||
je vnc_security
|
je vnc_security
|
||||||
|
|
||||||
|
DEBUGF 1, "Unknown security type\n"
|
||||||
jmp exit
|
jmp exit
|
||||||
|
|
||||||
vnc_security:
|
vnc_security:
|
||||||
mov byte[mode], 1
|
mov byte[mode], 1
|
||||||
call red_logon
|
call logon
|
||||||
|
|
||||||
no_security:
|
no_security:
|
||||||
mcall send, [socketnum], shared, 1, 0
|
mcall send, [socketnum], ClientInit, 1, 0
|
||||||
DEBUGF 1, 'Sending handshake: shared session?\n'
|
DEBUGF 1, "ClientInit sent\n"
|
||||||
|
|
||||||
call wait_for_data ; now the server should send init message
|
call wait_for_data ; now the server should send init message
|
||||||
|
|
||||||
DEBUGF 1, 'Serverinit: bpp: %u depth: %u bigendian: %u truecolor: %u\n', \
|
DEBUGF 1, "Serverinit: bpp: %u depth: %u bigendian: %u truecolor: %u\n", \
|
||||||
[receive_buffer+framebuffer.pixelformat.bpp]:1, \
|
[receive_buffer+framebuffer.pixelformat.bpp]:1, \
|
||||||
[receive_buffer+framebuffer.pixelformat.depth]:1, \
|
[receive_buffer+framebuffer.pixelformat.depth]:1, \
|
||||||
[receive_buffer+framebuffer.pixelformat.big_endian]:1, \
|
[receive_buffer+framebuffer.pixelformat.big_endian]:1, \
|
||||||
[receive_buffer+framebuffer.pixelformat.true_color]:1
|
[receive_buffer+framebuffer.pixelformat.true_color]:1
|
||||||
|
|
||||||
mov eax, dword [receive_buffer]
|
mov eax, dword[receive_buffer+framebuffer.width]
|
||||||
mov dword [fbur.width], eax
|
mov dword[fbur.width], eax
|
||||||
bswap eax
|
bswap eax
|
||||||
mov dword [screen], eax
|
mov dword[screen], eax
|
||||||
|
DEBUGF 1, "Screen width=%u, height=%u\n", [screen.width]:2, [screen.height]:2
|
||||||
|
|
||||||
mcall send, [socketnum], pixel_format8, 20, 0
|
mcall send, [socketnum], pixel_format8, 20, 0
|
||||||
DEBUGF 1, 'Sending pixel format\n'
|
DEBUGF 1, "Sending pixel format\n"
|
||||||
call read_data
|
|
||||||
|
|
||||||
; eth.write_tcp [socket],8,encodings
|
mcall send, [socketnum], encodings, 8, 0
|
||||||
; DEBUGF 1,'Sending encoding info\n'
|
DEBUGF 1, "Sending encoding info\n"
|
||||||
; call read_data
|
|
||||||
|
|
||||||
mov byte [thread_ready], 1
|
mov [thread_ready], 1
|
||||||
|
|
||||||
request_rfb:
|
; Request initial update
|
||||||
mov [fbur.inc], 2
|
mov [fbur.inc], 0
|
||||||
|
|
||||||
|
request_fbu:
|
||||||
|
DEBUGF 1, "Requesting framebuffer update\n"
|
||||||
mcall send, [socketnum], fbur, 10, 0
|
mcall send, [socketnum], fbur, 10, 0
|
||||||
|
mov [fbur.inc], 1
|
||||||
|
|
||||||
thread_loop:
|
thread_loop:
|
||||||
call read_data ; Read the data into the buffer
|
call read_data ; Read the data into the buffer
|
||||||
|
|
||||||
; cmp eax, 2
|
lodsb
|
||||||
; jb mainloop
|
cmp al, 0
|
||||||
|
|
||||||
DEBUGF 1,'Data received, %u bytes\n', eax
|
|
||||||
|
|
||||||
cmp byte [receive_buffer],0
|
|
||||||
je framebufferupdate
|
je framebufferupdate
|
||||||
|
cmp al, 1
|
||||||
cmp byte [receive_buffer],1
|
|
||||||
je setcolourmapentries
|
je setcolourmapentries
|
||||||
|
cmp al, 2
|
||||||
cmp byte [receive_buffer],2
|
|
||||||
je bell
|
je bell
|
||||||
|
cmp al, 3
|
||||||
cmp byte [receive_buffer],3
|
|
||||||
je servercuttext
|
je servercuttext
|
||||||
|
|
||||||
|
|
||||||
|
DEBUGF 1, "Unknown server command: %u\n", al
|
||||||
jmp thread_loop
|
jmp thread_loop
|
||||||
|
|
||||||
align 4
|
|
||||||
framebufferupdate:
|
framebufferupdate:
|
||||||
|
|
||||||
mov ax, word [receive_buffer+2]
|
@@:
|
||||||
|
lea eax, [esi+6]
|
||||||
|
cmp [datapointer], eax
|
||||||
|
jae @f
|
||||||
|
call read_data.more
|
||||||
|
jmp @b
|
||||||
|
@@:
|
||||||
|
|
||||||
|
inc esi ; padding
|
||||||
|
lodsw
|
||||||
xchg al, ah
|
xchg al, ah
|
||||||
mov di, ax
|
mov [rectangles], ax
|
||||||
DEBUGF 1, 'Framebufferupdate: %u frames\n', di
|
DEBUGF 1, "Framebufferupdate: %u rectangles\n", ax
|
||||||
mov esi, receive_buffer+4
|
|
||||||
jmp rectangle_loop
|
|
||||||
|
|
||||||
|
|
||||||
next_rectangle:
|
|
||||||
call drawbuffer
|
|
||||||
|
|
||||||
dec di
|
|
||||||
test di, di
|
|
||||||
jz request_rfb
|
|
||||||
|
|
||||||
rectangle_loop:
|
rectangle_loop:
|
||||||
|
|
||||||
mov edx, [esi]
|
@@:
|
||||||
bswap edx
|
lea eax, [esi+12]
|
||||||
mov ebx, edx
|
cmp [datapointer], eax
|
||||||
shr edx, 16
|
jae @f
|
||||||
mov [frame.x], dx
|
call read_data.more
|
||||||
mov [frame.y], bx
|
jmp @b
|
||||||
add esi, 4
|
@@:
|
||||||
mov ecx, [esi]
|
|
||||||
bswap ecx
|
|
||||||
mov eax, ecx
|
|
||||||
shr ecx, 16
|
|
||||||
mov [frame.width], cx
|
|
||||||
mov [frame.height], ax
|
|
||||||
add esi, 4
|
|
||||||
mov eax, [esi]
|
|
||||||
add esi, 4
|
|
||||||
|
|
||||||
mov ebx, esi
|
lodsd ; position
|
||||||
sub ebx, receive_buffer+12
|
bswap eax
|
||||||
DEBUGF 1, 'frame: width=%u height=%u x=%u y=%u offset:%u encoding:',\
|
mov [rectangle.y], ax
|
||||||
[frame.width]:2, [frame.height]:2, [frame.x]:2, [frame.y]:2, ebx
|
shr eax, 16
|
||||||
|
mov [rectangle.x], ax
|
||||||
|
|
||||||
|
lodsd ; size
|
||||||
|
bswap eax
|
||||||
|
mov [rectangle.height], ax
|
||||||
|
shr eax, 16
|
||||||
|
mov [rectangle.width], ax
|
||||||
|
|
||||||
|
lodsd ; encoding
|
||||||
|
DEBUGF 1, "rectangle: width=%u height=%u x=%u y=%u encoding: ",\
|
||||||
|
[rectangle.width]:2, [rectangle.height]:2, [rectangle.x]:2, [rectangle.y]:2
|
||||||
|
|
||||||
cmp eax, 0
|
cmp eax, 0
|
||||||
je encoding_raw
|
je encoding_raw
|
||||||
; cmp eax, 1
|
; cmp eax, 1
|
||||||
; je encoding_copyrect
|
; je encoding_copyrect
|
||||||
cmp eax, 2
|
; cmp eax, 2
|
||||||
je encoding_RRE
|
; je encoding_RRE
|
||||||
cmp eax, 5
|
; cmp eax, 5
|
||||||
je encoding_hextile
|
; je encoding_hextile
|
||||||
cmp eax, 16
|
; cmp eax, 15
|
||||||
je encoding_ZRLE
|
; je encoding_TRLE
|
||||||
|
; cmp eax, 16
|
||||||
|
; je encoding_ZRLE
|
||||||
|
|
||||||
mov ebx, esi
|
DEBUGF 1, "\nunknown encoding: %u\n", eax
|
||||||
sub ebx, receive_buffer+8
|
|
||||||
DEBUGF 1, '\nunknown encoding: %u (offset %u)\n', eax, ebx
|
|
||||||
jmp bell
|
|
||||||
jmp thread_loop
|
jmp thread_loop
|
||||||
|
|
||||||
encoding_RRE:
|
;; jmp rectangle_loop
|
||||||
|
|
||||||
DEBUGF 1, 'RRE\n'
|
next_rectangle:
|
||||||
|
push esi
|
||||||
|
call drawbuffer
|
||||||
|
pop esi
|
||||||
|
|
||||||
jmp next_rectangle
|
dec [rectangles]
|
||||||
|
jnz rectangle_loop
|
||||||
|
jmp request_fbu
|
||||||
|
|
||||||
encoding_hextile:
|
|
||||||
|
|
||||||
DEBUGF 1, 'hextile\n'
|
|
||||||
|
|
||||||
jmp next_rectangle
|
|
||||||
|
|
||||||
encoding_ZRLE:
|
|
||||||
|
|
||||||
DEBUGF 1, 'ZRLE\n'
|
|
||||||
|
|
||||||
jmp next_rectangle
|
|
||||||
|
|
||||||
setcolourmapentries:
|
setcolourmapentries:
|
||||||
|
|
||||||
DEBUGF 1, 'Server sent SetColourMapEntries message\n'
|
DEBUGF 1, "Server sent SetColourMapEntries message\n"
|
||||||
|
|
||||||
|
; TODO
|
||||||
|
|
||||||
jmp thread_loop
|
jmp thread_loop
|
||||||
|
|
||||||
|
|
||||||
bell:
|
bell:
|
||||||
mcall 55, 55, , , beep
|
mcall 55, 55, , , beep
|
||||||
|
|
||||||
jmp thread_loop
|
jmp thread_loop
|
||||||
|
|
||||||
|
|
||||||
servercuttext:
|
servercuttext:
|
||||||
|
|
||||||
DEBUGF 1, 'Server cut text\n'
|
DEBUGF 1, "Server cut text\n"
|
||||||
|
|
||||||
|
@@:
|
||||||
|
lea eax, [esi+7]
|
||||||
|
cmp [datapointer], eax
|
||||||
|
jae @f
|
||||||
|
call read_data.more
|
||||||
|
jmp @b
|
||||||
|
@@:
|
||||||
|
|
||||||
|
add esi, 3
|
||||||
|
lodsd
|
||||||
|
bswap eax
|
||||||
|
mov ecx, eax
|
||||||
|
|
||||||
|
@@:
|
||||||
|
lea eax, [esi+ecx]
|
||||||
|
cmp [datapointer], eax
|
||||||
|
jae @f
|
||||||
|
call read_data.more
|
||||||
|
jmp @b
|
||||||
|
@@:
|
||||||
|
|
||||||
|
; TODO: paste text to clipboard
|
||||||
|
|
||||||
|
DEBUGF 1, "%u bytes of text\n", ecx
|
||||||
|
add esi, ecx
|
||||||
jmp thread_loop
|
jmp thread_loop
|
||||||
|
|
||||||
|
|
||||||
read_data:
|
read_data:
|
||||||
mov [datapointer], receive_buffer
|
mov [datapointer], receive_buffer
|
||||||
.loop:
|
mov esi, receive_buffer
|
||||||
|
.more:
|
||||||
|
push ebx ecx edx esi edi
|
||||||
mcall recv, [socketnum], [datapointer], 4096, 0
|
mcall recv, [socketnum], [datapointer], 4096, 0
|
||||||
|
pop edi esi edx ecx ebx
|
||||||
cmp eax, -1
|
cmp eax, -1
|
||||||
je .done
|
je .error
|
||||||
|
add [datapointer], eax ; TODO: check for buffer overflow
|
||||||
add [datapointer], eax
|
|
||||||
|
|
||||||
cmp eax, 4096
|
cmp eax, 4096
|
||||||
je .loop
|
je .more
|
||||||
|
ret
|
||||||
|
|
||||||
.done:
|
.error:
|
||||||
mov eax, [datapointer]
|
DEBUGF 1, "Socket error!\n"
|
||||||
sub eax, receive_buffer
|
mcall -1
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
wait_for_data:
|
wait_for_data: ; FIXME: add timeout
|
||||||
mcall recv, [socketnum], receive_buffer, 4096, 0
|
mcall recv, [socketnum], receive_buffer, 4096, 0
|
||||||
cmp eax, -1
|
cmp eax, -1
|
||||||
je wait_for_data
|
je .error
|
||||||
test eax, eax
|
test eax, eax
|
||||||
jz wait_for_data
|
jz wait_for_data
|
||||||
|
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
.error:
|
||||||
|
DEBUGF 1, "Socket error!\n"
|
||||||
|
mcall -1
|
||||||
|
ret
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;; ;;
|
;; ;;
|
||||||
;; Copyright (C) KolibriOS team 2010-2013. All rights reserved. ;;
|
;; Copyright (C) KolibriOS team 2010-2015. All rights reserved. ;;
|
||||||
;; Distributed under terms of the GNU General Public License ;;
|
;; Distributed under terms of the GNU General Public License ;;
|
||||||
;; ;;
|
;; ;;
|
||||||
;; vncc.asm - VNC client for KolibriOS ;;
|
;; vncc.asm - VNC client for KolibriOS ;;
|
||||||
@ -17,7 +17,6 @@ format binary as ""
|
|||||||
__DEBUG__ = 1
|
__DEBUG__ = 1
|
||||||
__DEBUG_LEVEL__ = 1
|
__DEBUG_LEVEL__ = 1
|
||||||
|
|
||||||
STRLEN = 64 ; password and server max length
|
|
||||||
xpos = 4 ; coordinates of image
|
xpos = 4 ; coordinates of image
|
||||||
ypos = 22 ;
|
ypos = 22 ;
|
||||||
|
|
||||||
@ -27,7 +26,7 @@ use32
|
|||||||
|
|
||||||
org 0x0
|
org 0x0
|
||||||
|
|
||||||
db 'MENUET01' ; 8 byte id
|
db "MENUET01" ; 8 byte id
|
||||||
dd 0x01 ; header version
|
dd 0x01 ; header version
|
||||||
dd START ; start of code
|
dd START ; start of code
|
||||||
dd I_END ; size of image
|
dd I_END ; size of image
|
||||||
@ -36,17 +35,39 @@ use32
|
|||||||
dd 0x0 , 0x0 ; I_Param , I_Path
|
dd 0x0 , 0x0 ; I_Param , I_Path
|
||||||
|
|
||||||
|
|
||||||
include '../../macros.inc'
|
include "../../macros.inc"
|
||||||
include '../../debug-fdo.inc'
|
include "../../debug-fdo.inc"
|
||||||
include '../../proc32.inc'
|
include "../../proc32.inc"
|
||||||
include '../../dll.inc'
|
include "../../dll.inc"
|
||||||
include '../../struct.inc'
|
include "../../struct.inc"
|
||||||
include '../../network.inc'
|
include "../../develop/libraries/box_lib/trunk/box_lib.mac"
|
||||||
|
include "../../network.inc"
|
||||||
|
|
||||||
include 'structs.inc'
|
struct pixel_format
|
||||||
include 'logon.inc'
|
bpp db ?
|
||||||
include 'raw.inc'
|
depth db ?
|
||||||
include 'thread.inc'
|
big_endian db ?
|
||||||
|
true_color db ?
|
||||||
|
red_max dw ?
|
||||||
|
green_max dw ?
|
||||||
|
blue_max dw ?
|
||||||
|
red_shift db ?
|
||||||
|
green_shift db ?
|
||||||
|
blue_shift db ?
|
||||||
|
padding rb 3
|
||||||
|
ends
|
||||||
|
|
||||||
|
struct framebuffer
|
||||||
|
width dw ?
|
||||||
|
height dw ?
|
||||||
|
pixelformat pixel_format
|
||||||
|
name_length dd ?
|
||||||
|
name rb 256
|
||||||
|
ends
|
||||||
|
|
||||||
|
include "logon.inc"
|
||||||
|
include "raw.inc"
|
||||||
|
include "thread.inc"
|
||||||
|
|
||||||
START:
|
START:
|
||||||
|
|
||||||
@ -57,23 +78,22 @@ START:
|
|||||||
test eax, eax
|
test eax, eax
|
||||||
jnz exit
|
jnz exit
|
||||||
|
|
||||||
call red_logon
|
call logon
|
||||||
|
|
||||||
mcall 40, 0 ; no events
|
mcall 40, 0 ; disable all events
|
||||||
mcall 67, 0, 0, 0, 0 ; resize the window (hide it)
|
mcall 67, 0, 0, 0, 0 ; resize the window (hide it)
|
||||||
mcall 51, 1, thread_start, thread_stack
|
mcall 51, 1, thread_start, thread_stack
|
||||||
|
|
||||||
DEBUGF 1,'Thread created: %u\n', eax
|
DEBUGF 1,"Thread created: %u\n", eax
|
||||||
|
|
||||||
@@:
|
@@:
|
||||||
mcall 5, 10
|
mcall 5, 10
|
||||||
cmp byte [thread_ready], 0
|
cmp byte[thread_ready], 0
|
||||||
je @r
|
je @r
|
||||||
|
|
||||||
mcall 40, 100111b ; mouse, button, key, redraw
|
mcall 40, EVM_MOUSE + EVM_MOUSE_FILTER + EVM_KEY + EVM_REDRAW + EVM_BUTTON
|
||||||
|
|
||||||
|
mov edx, dword[screen]
|
||||||
mov edx, dword [screen]
|
|
||||||
movzx esi, dx
|
movzx esi, dx
|
||||||
shr edx, 16
|
shr edx, 16
|
||||||
add edx, 2*xpos
|
add edx, 2*xpos
|
||||||
@ -81,35 +101,31 @@ START:
|
|||||||
mcall 67, 10, 10 ; resize the window
|
mcall 67, 10, 10 ; resize the window
|
||||||
|
|
||||||
mainloop:
|
mainloop:
|
||||||
mcall 23, 50 ; wait for event, 0,5s timeout
|
mcall 10 ; wait for event
|
||||||
|
|
||||||
dec eax
|
dec eax
|
||||||
jz redraw
|
jz redraw
|
||||||
|
|
||||||
dec eax
|
dec eax
|
||||||
jz key
|
jz key
|
||||||
|
|
||||||
dec eax
|
dec eax
|
||||||
jz button
|
jz button
|
||||||
|
|
||||||
sub eax, 3
|
sub eax, 3
|
||||||
jz mouse
|
jz mouse
|
||||||
|
|
||||||
jmp mainloop
|
jmp mainloop
|
||||||
|
|
||||||
key:
|
key:
|
||||||
|
|
||||||
DEBUGF 1,'Sending key event\n'
|
; DEBUGF 1,"Sending key event\n"
|
||||||
|
|
||||||
mcall 2
|
mcall 2
|
||||||
mov byte [keyevent.key+3], ah
|
mov byte[keyevent.key+3], ah
|
||||||
|
|
||||||
mcall send, [socketnum], keyevent, 8, 0
|
mcall send, [socketnum], keyevent, 8, 0
|
||||||
jmp mainloop
|
jmp mainloop
|
||||||
|
|
||||||
mouse:
|
mouse:
|
||||||
|
|
||||||
DEBUGF 1,'Sending mouse event\n'
|
; DEBUGF 1,"Sending mouse event\n"
|
||||||
|
|
||||||
mcall 37, 1 ; get mouse pos
|
mcall 37, 1 ; get mouse pos
|
||||||
sub eax, xpos shl 16 + ypos
|
sub eax, xpos shl 16 + ypos
|
||||||
@ -121,7 +137,7 @@ mouse:
|
|||||||
mcall 37, 2 ; get mouse buttons
|
mcall 37, 2 ; get mouse buttons
|
||||||
test al, 00000010b ; test if right button was pressed (bit 1 in kolibri)
|
test al, 00000010b ; test if right button was pressed (bit 1 in kolibri)
|
||||||
jz @f
|
jz @f
|
||||||
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
|
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
|
||||||
@@:
|
@@:
|
||||||
mov [pointerevent.mask],al
|
mov [pointerevent.mask],al
|
||||||
|
|
||||||
@ -130,7 +146,7 @@ mouse:
|
|||||||
|
|
||||||
redraw:
|
redraw:
|
||||||
|
|
||||||
DEBUGF 1,'Drawing window\n'
|
; DEBUGF 1,"Drawing window\n"
|
||||||
|
|
||||||
mcall 12, 1
|
mcall 12, 1
|
||||||
|
|
||||||
@ -148,25 +164,23 @@ redraw:
|
|||||||
jmp mainloop
|
jmp mainloop
|
||||||
|
|
||||||
drawbuffer:
|
drawbuffer:
|
||||||
|
|
||||||
mcall 7, framebuffer_data, dword[screen], 0
|
mcall 7, framebuffer_data, dword[screen], 0
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
|
||||||
button:
|
button:
|
||||||
mcall 17 ; get id
|
mcall 17 ; get id
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
DEBUGF 1, 'Closing time!\n'
|
DEBUGF 1, "Closing time!\n"
|
||||||
mcall close, [socketnum]
|
mcall close, [socketnum]
|
||||||
mcall -1
|
mcall -1
|
||||||
|
|
||||||
no_rfb:
|
no_rfb:
|
||||||
DEBUGF 1, 'This is no vnc server!\n'
|
DEBUGF 1, "This is no vnc server!\n"
|
||||||
jmp exit
|
jmp exit
|
||||||
|
|
||||||
invalid_security:
|
invalid_security:
|
||||||
DEBUGF 1, 'Security error: %s\n', receive_buffer+5
|
DEBUGF 1, "Security error: %s\n", receive_buffer+5
|
||||||
jmp exit
|
jmp exit
|
||||||
|
|
||||||
|
|
||||||
@ -174,118 +188,143 @@ invalid_security:
|
|||||||
|
|
||||||
include_debug_strings ; ALWAYS present in data section
|
include_debug_strings ; ALWAYS present in data section
|
||||||
|
|
||||||
handshake db 'RFB 003.003', 10
|
handshake db "RFB 003.003", 10
|
||||||
shared db 0
|
ClientInit db 0 ; not shared
|
||||||
beep db 0x85,0x25,0x85,0x40,0
|
beep db 0x85, 0x25, 0x85, 0x40, 0
|
||||||
|
|
||||||
pixel_format32 db 0 ; setPixelformat
|
pixel_format32 db 0 ; setPixelformat
|
||||||
rb 3 ; padding
|
db 0, 0, 0 ; padding
|
||||||
.bpp db 32 ; bits per pixel
|
.bpp db 32 ; bits per pixel
|
||||||
.depth db 32 ; depth
|
.depth db 32 ; depth
|
||||||
.big_endian db 0 ; big-endian flag
|
.big_endian db 0 ; big-endian flag
|
||||||
.true_color db 1 ; true-colour flag
|
.true_color db 1 ; true-colour flag
|
||||||
.red_max db 0,255 ; red-max
|
.red_max db 0, 255 ; red-max
|
||||||
.green_max db 0,255 ; green-max
|
.green_max db 0, 255 ; green-max
|
||||||
.blue_max db 0,255 ; blue-max
|
.blue_max db 0, 255 ; blue-max
|
||||||
.red_shif db 0 ; red-shift
|
.red_shif db 0 ; red-shift
|
||||||
.green_shift db 8 ; green-shift
|
.green_shift db 8 ; green-shift
|
||||||
.blue_shift db 16 ; blue-shift
|
.blue_shift db 16 ; blue-shift
|
||||||
rb 3 ; padding
|
db 0, 0, 0 ; padding
|
||||||
|
|
||||||
pixel_format16 db 0 ; setPixelformat
|
pixel_format16 db 0 ; setPixelformat
|
||||||
rb 3 ; padding
|
db 0, 0, 0 ; padding
|
||||||
.bpp db 16 ; bits per pixel
|
.bpp db 16 ; bits per pixel
|
||||||
.depth db 15 ; depth
|
.depth db 15 ; depth
|
||||||
.big_endian db 0 ; big-endian flag
|
.big_endian db 0 ; big-endian flag
|
||||||
.true_color db 1 ; true-colour flag
|
.true_color db 1 ; true-colour flag
|
||||||
.red_max db 0,31 ; red-max
|
.red_max db 0, 31 ; red-max
|
||||||
.green_max db 0,31 ; green-max
|
.green_max db 0, 31 ; green-max
|
||||||
.blue_max db 0,31 ; blue-max
|
.blue_max db 0, 31 ; blue-max
|
||||||
.red_shif db 0 ; red-shift
|
.red_shif db 0 ; red-shift
|
||||||
.green_shift db 5 ; green-shift
|
.green_shift db 5 ; green-shift
|
||||||
.blue_shift db 10 ; blue-shift
|
.blue_shift db 10 ; blue-shift
|
||||||
rb 3 ; padding
|
db 0, 0, 0 ; padding
|
||||||
|
|
||||||
pixel_format8 db 0 ; setPixelformat
|
pixel_format8 db 0 ; setPixelformat
|
||||||
rb 3 ; padding
|
db 0, 0, 0 ; padding
|
||||||
.bpp db 8 ; bits per pixel
|
.bpp db 8 ; bits per pixel
|
||||||
.depth db 6 ; depth
|
.depth db 6 ; depth
|
||||||
.big_endian db 0 ; big-endian flag
|
.big_endian db 0 ; big-endian flag
|
||||||
.true_color db 1 ; true-colour flag
|
.true_color db 1 ; true-colour flag
|
||||||
.red_max db 0,3 ; red-max
|
.red_max db 0, 3 ; red-max
|
||||||
.green_max db 0,3 ; green-max
|
.green_max db 0, 3 ; green-max
|
||||||
.blue_max db 0,3 ; blue-max
|
.blue_max db 0, 3 ; blue-max
|
||||||
.red_shif db 0 ; red-shift
|
.red_shif db 0 ; red-shift
|
||||||
.green_shift db 2 ; green-shift
|
.green_shift db 2 ; green-shift
|
||||||
.blue_shift db 4 ; blue-shift
|
.blue_shift db 4 ; blue-shift
|
||||||
rb 3 ; padding
|
db 0, 0, 0 ; padding
|
||||||
|
|
||||||
encodings db 2 ; setEncodings
|
encodings db 2 ; setEncodings
|
||||||
rb 1 ; padding
|
db 0 ; padding
|
||||||
db 1,0 ; number of encodings
|
db 0, 1 ; number of encodings
|
||||||
db 0,0,0,0 ; raw encoding (DWORD, Big endian order)
|
db 0, 0, 0 ,0 ; raw encoding (DWORD, Big endian order)
|
||||||
db 1,0,0,0 ; Copyrect encoding
|
; db 1, 0, 0, 0 ; Copyrect encoding
|
||||||
|
; db
|
||||||
|
|
||||||
fbur db 3 ; frame buffer update request
|
fbur db 3 ; frame buffer update request
|
||||||
.inc db 0 ; incremental
|
.inc db 0 ; incremental
|
||||||
.x dw 0
|
.x dw 0
|
||||||
.y dw 0
|
.y dw 0
|
||||||
.width dw 0
|
.width dw 0
|
||||||
.height dw 0
|
.height dw 0
|
||||||
|
|
||||||
keyevent db 4 ; keyevent
|
keyevent db 4 ; keyevent
|
||||||
.down db 0 ; down-flag
|
.down db 0 ; down-flag
|
||||||
dw 0 ; padding
|
dw 0 ; padding
|
||||||
.key dd 0 ; key
|
.key dd 0 ; key
|
||||||
|
|
||||||
pointerevent db 5 ; pointerevent
|
pointerevent db 5 ; pointerevent
|
||||||
.mask db 0 ; button-mask
|
.mask db 0 ; button-mask
|
||||||
.x dw 0 ; x-position
|
.x dw 0 ; x-position
|
||||||
.y dw 0 ; y-position
|
.y dw 0 ; y-position
|
||||||
|
|
||||||
|
|
||||||
sockaddr1:
|
sockaddr1:
|
||||||
dw AF_INET4
|
dw AF_INET4
|
||||||
.port dw 0x0c17 ; 5900
|
.port dw 0x0c17 ; 5900
|
||||||
.ip dd 0
|
.ip dd 0
|
||||||
rb 10
|
rb 10
|
||||||
|
|
||||||
thread_ready db 0
|
thread_ready db 0
|
||||||
|
mouse_dd dd ?
|
||||||
|
|
||||||
|
URLbox edit_box 200, 25, 16, 0xffffff, 0x6f9480, 0, 0, 0, 65535, serveraddr, mouse_dd, ed_focus, 0, 0
|
||||||
|
|
||||||
; import
|
; import
|
||||||
align 4
|
align 4
|
||||||
@IMPORT:
|
@IMPORT:
|
||||||
|
|
||||||
library network, 'network.obj'
|
library network, "network.obj",\
|
||||||
import network, \
|
box_lib, "box_lib.obj",\
|
||||||
getaddrinfo, 'getaddrinfo', \
|
archiver, "archiver.obj"
|
||||||
freeaddrinfo, 'freeaddrinfo', \
|
|
||||||
inet_ntoa, 'inet_ntoa'
|
|
||||||
|
|
||||||
name db 'VNC client', 0
|
import network,\
|
||||||
|
getaddrinfo, "getaddrinfo", \
|
||||||
|
freeaddrinfo, "freeaddrinfo", \
|
||||||
|
inet_ntoa, "inet_ntoa"
|
||||||
|
|
||||||
|
import box_lib,\
|
||||||
|
edit_box_draw, "edit_box",\
|
||||||
|
edit_box_key, "edit_box_key",\
|
||||||
|
edit_box_mouse, "edit_box_mouse",\
|
||||||
|
scrollbar_v_draw, "scrollbar_v_draw",\
|
||||||
|
scrollbar_v_mouse, "scrollbar_v_mouse",\
|
||||||
|
scrollbar_h_draw, "scrollbar_h_draw",\
|
||||||
|
scrollbar_h_mouse, "scrollbar_h_mouse"
|
||||||
|
|
||||||
|
import archiver,\
|
||||||
|
deflate_unpack, "deflate_unpack"
|
||||||
|
|
||||||
|
name db "VNC client "
|
||||||
|
name.dash db 0, " "
|
||||||
|
|
||||||
I_END:
|
I_END:
|
||||||
|
|
||||||
socketnum dd ?
|
servername rb 64+1
|
||||||
datapointer dd ?
|
|
||||||
|
|
||||||
frame:
|
socketnum dd ?
|
||||||
.width dw ?
|
datapointer dd ?
|
||||||
.height dw ?
|
rectangles dw ?
|
||||||
.x dw ?
|
|
||||||
.y dw ?
|
|
||||||
|
|
||||||
screen:
|
rectangle:
|
||||||
.height dw ?
|
.width dw ?
|
||||||
.width dw ?
|
.height dw ?
|
||||||
|
.x dw ?
|
||||||
|
.y dw ?
|
||||||
|
|
||||||
receive_buffer rb 5*1024*1024 ; 5 mb buffer for received data (incoming frbupdate etc)
|
screen: ; Remote screen resolution
|
||||||
framebuffer_data rb 1024*768*3 ; framebuffer
|
.height dw ?
|
||||||
|
.width dw ?
|
||||||
|
|
||||||
|
serveraddr rb 65536
|
||||||
|
receive_buffer rb 5*1024*1024 ; 5 mb buffer for received data (incoming frbupdate etc)
|
||||||
|
framebuffer_data rb 1024*1024*3 ; framebuffer
|
||||||
|
|
||||||
rb 0x1000
|
rb 0x1000
|
||||||
thread_stack:
|
thread_stack:
|
||||||
|
|
||||||
rb 0x1000
|
rb 0x1000
|
||||||
|
|
||||||
IM_END:
|
IM_END:
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user