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,204 +1,43 @@
|
|||||||
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
|
|
||||||
|
|
||||||
dec eax ; redraw request ?
|
|
||||||
jz red_logon
|
|
||||||
dec eax ; key in buffer ?
|
|
||||||
jz key_logon
|
|
||||||
dec eax ; button in buffer ?
|
|
||||||
jz button_logon
|
|
||||||
|
|
||||||
jmp still_logon
|
|
||||||
|
|
||||||
key_logon: ; key event handler
|
|
||||||
mov al,2 ; eax was zero so will now be 2
|
|
||||||
mcall ; just read it and ignore
|
|
||||||
|
|
||||||
cmp ah,13
|
|
||||||
jne still_logon ; return to main loop
|
|
||||||
|
|
||||||
ret ; enter key was pressed => return to logon
|
|
||||||
|
|
||||||
button_logon: ; eax was zero so will now be 17
|
|
||||||
mov al,17 ; get id
|
|
||||||
mcall
|
|
||||||
|
|
||||||
cmp ah,1 ; close ?
|
|
||||||
jz close_logon
|
|
||||||
cmp ah,2 ; logon ?
|
|
||||||
je connect_logon
|
|
||||||
cmp ah,5 ; first ?
|
|
||||||
jz dstbtn_logon
|
|
||||||
|
|
||||||
srcbtn_logon:
|
|
||||||
mov dword[addr],first
|
|
||||||
jmp rk_logon
|
|
||||||
|
|
||||||
dstbtn_logon:
|
|
||||||
mov dword[addr],second
|
|
||||||
|
|
||||||
rk_logon:
|
|
||||||
mov edi,[addr] ; load the address of the string
|
|
||||||
xor al,al ; mov al,0 ; the symbol we will search for
|
|
||||||
mov ecx,STRLEN+1 ; length of the string (+1)
|
|
||||||
cld ; search forward
|
|
||||||
repne scasb ; do search now
|
|
||||||
inc ecx ; we've found a zero or ecx became 0
|
|
||||||
mov eax,STRLEN+1
|
|
||||||
sub eax,ecx ; eax = address of <0> character
|
|
||||||
mov [temp],eax ; position
|
|
||||||
|
|
||||||
cmp dword[addr],dword second
|
|
||||||
jne @f
|
|
||||||
mov dword [passlen],eax
|
|
||||||
@@:
|
|
||||||
|
|
||||||
call print_text_logon
|
|
||||||
|
|
||||||
mov edi,[addr] ; address of string
|
|
||||||
add edi,[temp] ; cursor position
|
|
||||||
|
|
||||||
.waitev_logon:
|
|
||||||
mov eax,10 ; wait for event
|
|
||||||
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
|
|
||||||
jne @f
|
|
||||||
dec [passlen]
|
|
||||||
@@:
|
|
||||||
|
|
||||||
call print_text_logon
|
|
||||||
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:
|
|
||||||
mov [edi],al
|
|
||||||
|
|
||||||
cmp dword[addr],second
|
|
||||||
jne @f
|
|
||||||
inc [passlen]
|
|
||||||
@@:
|
|
||||||
|
|
||||||
call print_text_logon
|
|
||||||
|
|
||||||
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:
|
|
||||||
|
|
||||||
|
.redraw:
|
||||||
mcall 12, 1 ; start window draw
|
mcall 12, 1 ; start window draw
|
||||||
pusha
|
pusha
|
||||||
; DRAW WINDOW
|
; DRAW WINDOW
|
||||||
xor eax, eax ; function 0 _logon: define and draw window
|
xor eax, eax ; function 0 _logon: define and draw window
|
||||||
mov ebx, 160*65536+330 ; [x start] *65536 + [x size]
|
mov ebx, 160 shl 16 + 330 ; [x start]:[x size]
|
||||||
mov ecx, 160*65536+100 ; [y start] *65536 + [y size]
|
mov ecx, 160 shl 16 + 100 ; [y start]:[y size]
|
||||||
mov edx, 0x13DDDDDD ; color of work area RRGGBB
|
mov edx, 0x34DDDDDD ; color of work area RRGGBB
|
||||||
mov edi, title ; WINDOW LABEL
|
mov edi, name ; WINDOW LABEL
|
||||||
mcall
|
mcall
|
||||||
|
|
||||||
mov eax, 8 ; LOGON BUTTON
|
mov eax, 8 ; LOGON BUTTON
|
||||||
mov ebx, 220*65536+85
|
mov ebx, 220 shl 16 + 85
|
||||||
mov ecx, 63*65536+16
|
mov ecx, 47 shl 16 + 16
|
||||||
mov edx, 2
|
mov edx, 2
|
||||||
mov esi, 0xCCCCCC
|
mov esi, 0xCCCCCC
|
||||||
mcall
|
mcall
|
||||||
|
|
||||||
|
|
||||||
call print_text_logon
|
|
||||||
|
|
||||||
cmp byte[mode], 0
|
cmp byte[mode], 0
|
||||||
je servermode_
|
je .servermode
|
||||||
|
|
||||||
mov eax, 4 ; function 4 write text to window
|
mov eax, 4 ; function 4 write text to window
|
||||||
mov ebx, 25*65536+33 ; [x start] *65536 + [y start]
|
mov ebx, 25 shl 16 + 15 ; [x start]:[y start]
|
||||||
xor ecx, ecx
|
xor ecx, ecx
|
||||||
mov edx, userstr ; pointer to text beginning
|
mov edx, userstr ; pointer to text beginning
|
||||||
mov esi, passstr-userstr ; text length
|
mov esi, passstr-userstr ; text length
|
||||||
@ -209,20 +48,20 @@ draw_window_logon:
|
|||||||
mov esi, connectstr-passstr ; text length
|
mov esi, connectstr-passstr ; text length
|
||||||
mcall
|
mcall
|
||||||
|
|
||||||
jmp drawtherest_
|
jmp .drawtherest
|
||||||
|
|
||||||
servermode_:
|
|
||||||
|
|
||||||
|
.servermode:
|
||||||
mov eax, 4 ; function 4 write text to window
|
mov eax, 4 ; function 4 write text to window
|
||||||
mov ebx, 25*65536+33 ; [x start] *65536 + [y start]
|
mov ebx, 25 shl 16 + 15 ; [x start] *65536 + [y start]
|
||||||
xor ecx, ecx
|
xor ecx, ecx
|
||||||
mov edx, serverstr ; pointer to text beginning
|
mov edx, serverstr ; pointer to text beginning
|
||||||
mov esi, userstr-serverstr ; text length
|
mov esi, userstr-serverstr ; text length
|
||||||
mcall
|
mcall
|
||||||
|
|
||||||
drawtherest_:
|
invoke edit_box_draw, URLbox
|
||||||
|
|
||||||
mov ebx, 240*65536+67 ; [x start] *65536 + [y start]
|
.drawtherest:
|
||||||
|
mov ebx, 240 shl 16 + 49 ; [x start] *65536 + [y start]
|
||||||
mov edx, connectstr ; pointer to text beginning
|
mov edx, connectstr ; pointer to text beginning
|
||||||
mov esi, connect_e-connectstr ; text length
|
mov esi, connect_e-connectstr ; text length
|
||||||
mcall
|
mcall
|
||||||
@ -231,27 +70,66 @@ draw_window_logon:
|
|||||||
inc ebx
|
inc ebx
|
||||||
mcall
|
mcall
|
||||||
|
|
||||||
|
.loop:
|
||||||
|
mcall 10 ; wait for event
|
||||||
|
dec eax ; redraw request ?
|
||||||
|
jz .redraw
|
||||||
|
dec eax ; key in buffer ?
|
||||||
|
jz .key
|
||||||
|
dec eax ; button in buffer ?
|
||||||
|
jz .btn
|
||||||
|
sub eax, 3
|
||||||
|
jz .mouse
|
||||||
|
jmp .loop
|
||||||
|
|
||||||
|
.key: ; key event handler
|
||||||
|
mcall 2 ; read key
|
||||||
|
|
||||||
|
test [URLbox.flags], ed_focus
|
||||||
|
jz mainloop
|
||||||
|
cmp ah, 13 ; enter (return) key
|
||||||
|
je .go
|
||||||
|
invoke edit_box_key, URLbox
|
||||||
|
jmp .loop
|
||||||
|
|
||||||
|
.go:
|
||||||
|
mov eax, [URLbox.pos]
|
||||||
|
mov byte[serveraddr+eax], 0
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
.btn:
|
||||||
|
mcall 17 ; get id
|
||||||
|
|
||||||
|
cmp ah, 1 ; close ?
|
||||||
|
jz .close
|
||||||
|
cmp ah, 2 ; logon ?
|
||||||
|
je .go
|
||||||
|
|
||||||
|
jmp .loop
|
||||||
|
|
||||||
|
.mouse:
|
||||||
|
mcall 23
|
||||||
|
invoke edit_box_mouse, URLbox
|
||||||
|
|
||||||
|
jmp .loop
|
||||||
|
|
||||||
|
.close:
|
||||||
|
mcall -1
|
||||||
|
|
||||||
|
|
||||||
; 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 @@
|
|||||||
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
;; ;;
|
||||||
|
;; 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 ;;
|
||||||
|
;; ;;
|
||||||
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
encoding_raw:
|
encoding_raw:
|
||||||
DEBUGF 1,'RAW\n'
|
|
||||||
|
|
||||||
mov ax,[frame.y] ;
|
DEBUGF 1,"RAW\n"
|
||||||
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 ;
|
movzx eax, [rectangle.width]
|
||||||
mul edx ; ([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
|
||||||
|
@@:
|
||||||
|
|
||||||
add eax,framebuffer_data ;
|
movzx eax, [rectangle.y]
|
||||||
push eax ; framebuffer_data+([screen.width]*[frame.y]+[frame.x])*3
|
movzx ebx, [screen.width]
|
||||||
|
mul ebx ; [screen.width]*[rectangle.y]
|
||||||
|
movzx ebx, [rectangle.x]
|
||||||
|
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
|
||||||
|
|
||||||
mov ax,[frame.width] ;
|
movzx eax, [screen.width]
|
||||||
mov bx,3 ;
|
sub ax, [rectangle.width]
|
||||||
mul bx ;
|
lea ebp, [eax*3] ; ebp = ([screen.width]-[rectangle.width])*3
|
||||||
shl edx,16 ;
|
|
||||||
mov dx,ax ; [frame.width]*3
|
|
||||||
|
|
||||||
pop eax ;
|
mov bl, 85
|
||||||
add edx,eax ; framebuffer_data+([screen.width]*[frame.y]+[frame.x])*3+[frame.width]*3
|
|
||||||
push eax ;
|
|
||||||
push edx ;
|
|
||||||
|
|
||||||
mov ax,[frame.height] ;
|
movzx edx, [rectangle.height]
|
||||||
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:
|
.lineloop:
|
||||||
cmp ebx,ecx
|
movzx ecx, [rectangle.width]
|
||||||
jge next_rectangle
|
|
||||||
|
|
||||||
; add esi,2 ; 32 bit code RAW - OK
|
.pixelloop:
|
||||||
; mov al,[esi] ;
|
mov al, [esi]
|
||||||
; mov [ebx],al ;
|
shr al, 4
|
||||||
; inc ebx ;
|
and al, 3
|
||||||
; dec esi ;
|
mul bl
|
||||||
; ;
|
stosb
|
||||||
; 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
|
mov al, [esi]
|
||||||
; mov cl,51
|
shr al, 2
|
||||||
;
|
and al, 3
|
||||||
; mov ax,[esi] ;
|
mul bl
|
||||||
; xchg al,ah
|
stosb
|
||||||
; and al,00011111b ;
|
|
||||||
; 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 ;
|
and al, 3
|
||||||
;
|
mul bl
|
||||||
mov al,[esi] ;
|
stosb
|
||||||
shr al,4 ;
|
|
||||||
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 ;
|
|
||||||
|
|
||||||
|
inc esi
|
||||||
|
dec ecx
|
||||||
|
jnz .pixelloop
|
||||||
|
|
||||||
cmp ebx,edx
|
add edi, ebp
|
||||||
jl .pixelloop32
|
dec edx
|
||||||
|
jnz .lineloop
|
||||||
push edx
|
jmp next_rectangle
|
||||||
push ebx
|
|
||||||
mov ax,[screen.width]
|
|
||||||
mov bx,3
|
|
||||||
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,22 +30,27 @@ 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
|
||||||
|
|
||||||
@ -45,187 +63,212 @@ thread_start:
|
|||||||
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,21 +78,20 @@ 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
|
||||||
@ -81,25 +101,21 @@ 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
|
||||||
@ -109,7 +125,7 @@ key:
|
|||||||
|
|
||||||
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,12 +188,12 @@ 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
|
||||||
@ -190,10 +204,10 @@ pixel_format32 db 0 ; setPixelformat
|
|||||||
.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
|
||||||
@ -204,10 +218,10 @@ pixel_format16 db 0 ; setPixelformat
|
|||||||
.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
|
||||||
@ -218,13 +232,14 @@ pixel_format8 db 0 ; setPixelformat
|
|||||||
.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
|
||||||
@ -251,41 +266,65 @@ sockaddr1:
|
|||||||
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:
|
||||||
|
|
||||||
|
servername rb 64+1
|
||||||
|
|
||||||
socketnum dd ?
|
socketnum dd ?
|
||||||
datapointer dd ?
|
datapointer dd ?
|
||||||
|
rectangles dw ?
|
||||||
|
|
||||||
frame:
|
rectangle:
|
||||||
.width dw ?
|
.width dw ?
|
||||||
.height dw ?
|
.height dw ?
|
||||||
.x dw ?
|
.x dw ?
|
||||||
.y dw ?
|
.y dw ?
|
||||||
|
|
||||||
screen:
|
screen: ; Remote screen resolution
|
||||||
.height dw ?
|
.height dw ?
|
||||||
.width dw ?
|
.width dw ?
|
||||||
|
|
||||||
|
serveraddr rb 65536
|
||||||
receive_buffer rb 5*1024*1024 ; 5 mb buffer for received data (incoming frbupdate etc)
|
receive_buffer rb 5*1024*1024 ; 5 mb buffer for received data (incoming frbupdate etc)
|
||||||
framebuffer_data rb 1024*768*3 ; framebuffer
|
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