Rev 260 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
260 | hidnplayr | 1 | red_logon: |
2 | call draw_window_logon ; at first, draw the window |
||
3 | |||
4 | still_logon: ; main cycle of application begins here |
||
5 | mov eax,10 ; wait here for event |
||
485 | heavyiron | 6 | mcall |
260 | hidnplayr | 7 | |
8 | checkevent_logon: ; Check what event was called _logon: this will be used to return from textbox focus |
||
9 | |||
10 | dec eax ; redraw request ? |
||
11 | jz red_logon |
||
12 | dec eax ; key in buffer ? |
||
13 | jz key_logon |
||
14 | dec eax ; button in buffer ? |
||
15 | jz button_logon |
||
16 | |||
17 | jmp still_logon |
||
18 | |||
19 | key_logon: ; key event handler |
||
20 | mov al,2 ; eax was zero so will now be 2 |
||
485 | heavyiron | 21 | mcall ; just read it and ignore |
260 | hidnplayr | 22 | |
23 | cmp ah,13 |
||
24 | jne still_logon ; return to main loop |
||
25 | |||
26 | ret ; enter key was pressed => return to logon |
||
27 | |||
28 | button_logon: ; eax was zero so will now be 17 |
||
29 | mov al,17 ; get id |
||
485 | heavyiron | 30 | mcall |
260 | hidnplayr | 31 | |
32 | cmp ah,1 ; close ? |
||
33 | jz close_logon |
||
34 | cmp ah,2 ; logon ? |
||
35 | je connect_logon |
||
36 | cmp ah,5 ; first ? |
||
37 | jz dstbtn_logon |
||
38 | |||
39 | srcbtn_logon: |
||
40 | mov dword[addr],first |
||
41 | jmp rk_logon |
||
42 | |||
43 | dstbtn_logon: |
||
44 | mov dword[addr],second |
||
45 | |||
46 | rk_logon: |
||
47 | mov edi,[addr] ; load the address of the string |
||
48 | xor al,al ; mov al,0 ; the symbol we will search for |
||
49 | mov ecx,STRLEN+1 ; length of the string (+1) |
||
50 | cld ; search forward |
||
51 | repne scasb ; do search now |
||
52 | inc ecx ; we've found a zero or ecx became 0 |
||
53 | mov eax,STRLEN+1 |
||
54 | sub eax,ecx ; eax = address of <0> character |
||
55 | mov [temp],eax ; position |
||
56 | |||
57 | cmp dword[addr],dword second |
||
58 | jne @f |
||
59 | mov dword [passlen],eax |
||
60 | @@: |
||
61 | |||
62 | call print_text_logon |
||
63 | |||
64 | mov edi,[addr] ; address of string |
||
65 | add edi,[temp] ; cursor position |
||
66 | |||
67 | .waitev_logon: |
||
68 | mov eax,10 ; wait for event |
||
485 | heavyiron | 69 | mcall |
260 | hidnplayr | 70 | cmp eax,2 ; button presed ? |
71 | jne checkevent_logon ; a key is pressed or redraw is nessesary, goto checkevent |
||
485 | heavyiron | 72 | mcall ; eax = 2, read button |
260 | hidnplayr | 73 | shr eax,8 |
74 | cmp eax,8 |
||
75 | jnz .nobs_logon ; BACKSPACE |
||
76 | cmp edi,[addr] |
||
77 | jz .waitev_logon |
||
78 | dec edi |
||
79 | mov byte[edi],0 |
||
80 | |||
81 | cmp dword[addr],second |
||
82 | jne @f |
||
83 | dec [passlen] |
||
84 | @@: |
||
85 | |||
86 | call print_text_logon |
||
87 | jmp .waitev_logon |
||
88 | .nobs_logon: |
||
89 | cmp eax,13 ; ENTER |
||
90 | je still_logon |
||
91 | cmp eax,192 |
||
92 | jne .noclear_logon |
||
93 | xor al,al |
||
94 | mov edi,[addr] |
||
95 | mov ecx,STRLEN |
||
96 | rep stosb |
||
97 | mov edi,[addr] |
||
98 | call print_text_logon |
||
99 | jmp .waitev_logon |
||
100 | |||
101 | .noclear_logon: |
||
102 | mov [edi],al |
||
103 | |||
104 | cmp dword[addr],second |
||
105 | jne @f |
||
106 | inc [passlen] |
||
107 | @@: |
||
108 | |||
109 | call print_text_logon |
||
110 | |||
111 | inc edi |
||
112 | mov esi,[addr] |
||
113 | add esi,STRLEN |
||
114 | cmp esi,edi |
||
115 | jnz .waitev_logon |
||
116 | |||
117 | jmp still_logon |
||
118 | |||
119 | |||
120 | ; print strings (source & destination) |
||
121 | print_text_logon: |
||
122 | pusha |
||
123 | |||
124 | mov eax, 8 |
||
125 | mov ebx, 105*65536+200 |
||
126 | mov ecx, 33*65536+12 |
||
127 | mov edx, 4 |
||
128 | mov esi, 0xEBEBEB |
||
485 | heavyiron | 129 | mcall |
260 | hidnplayr | 130 | |
131 | cmp byte[mode],0 |
||
132 | je @f |
||
133 | |||
134 | mov ecx, 49*65536+12 |
||
135 | inc edx |
||
485 | heavyiron | 136 | mcall |
260 | hidnplayr | 137 | |
138 | @@: |
||
139 | mov eax, 4 ; function 4 _logon: write text to window |
||
140 | mov ebx, 107*65536+34 ; [x start] *65536 + [y start] |
||
141 | xor ecx, ecx ; color of text RRGGBB |
||
142 | mov edx, first ; pointer to text beginning |
||
143 | mov esi, STRLEN ; text length |
||
485 | heavyiron | 144 | mcall |
260 | hidnplayr | 145 | |
146 | cmp byte[mode],0 |
||
147 | je dont_draw_pass |
||
148 | |||
149 | add ebx,16 |
||
150 | mov edi,[passlen] |
||
151 | |||
152 | @@: |
||
153 | cmp edi,0 |
||
154 | jle dont_draw_pass |
||
155 | |||
156 | dec edi |
||
157 | mov edx, passchar |
||
158 | mov esi, 1 |
||
485 | heavyiron | 159 | mcall |
260 | hidnplayr | 160 | add ebx,6*65536 |
161 | jmp @r |
||
162 | |||
163 | dont_draw_pass: |
||
164 | |||
165 | popa |
||
166 | ret |
||
167 | |||
168 | close_logon: |
||
485 | heavyiron | 169 | or eax,-1 |
170 | mcall |
||
260 | hidnplayr | 171 | |
172 | connect_logon: |
||
173 | ret |
||
174 | |||
175 | draw_window_logon: |
||
176 | |||
177 | mov eax, 12 ; function 12_logon:tell os about windowdraw |
||
178 | mov ebx, 1 ; 1, start of draw |
||
485 | heavyiron | 179 | mcall |
260 | hidnplayr | 180 | pusha |
181 | ; DRAW WINDOW |
||
182 | xor eax, eax ; function 0 _logon: define and draw window |
||
183 | mov ebx, 160*65536+330 ; [x start] *65536 + [x size] |
||
184 | mov ecx, 160*65536+100 ; [y start] *65536 + [y size] |
||
485 | heavyiron | 185 | mov edx, 0x13DDDDDD ; color of work area RRGGBB |
186 | mov edi, title ; WINDOW LABEL |
||
187 | mcall |
||
260 | hidnplayr | 188 | |
189 | mov eax, 8 ; LOGON BUTTON |
||
190 | mov ebx, 220*65536+85 |
||
191 | mov ecx, 63*65536+16 |
||
192 | mov edx, 2 |
||
193 | mov esi, 0xCCCCCC |
||
485 | heavyiron | 194 | mcall |
260 | hidnplayr | 195 | |
196 | call print_text_logon |
||
485 | heavyiron | 197 | |
260 | hidnplayr | 198 | cmp byte[mode],0 |
199 | je servermode_ |
||
200 | |||
485 | heavyiron | 201 | mov eax, 4 ; function 4 _logon: write text to window |
260 | hidnplayr | 202 | mov ebx, 25*65536+33 ; [x start] *65536 + [y start] |
203 | xor ecx, ecx |
||
204 | mov edx, userstr ; pointer to text beginning |
||
205 | mov esi, passstr-userstr ; text length |
||
485 | heavyiron | 206 | mcall |
260 | hidnplayr | 207 | |
208 | add bl,16 |
||
209 | mov edx, passstr ; pointer to text beginning |
||
210 | mov esi, connect-passstr ; text length |
||
485 | heavyiron | 211 | mcall |
260 | hidnplayr | 212 | |
213 | jmp drawtherest_ |
||
214 | |||
215 | servermode_: |
||
216 | |||
217 | mov ebx, 25*65536+33 ; [x start] *65536 + [y start] |
||
218 | xor ecx, ecx |
||
219 | mov edx, serverstr ; pointer to text beginning |
||
220 | mov esi, userstr-serverstr ; text length |
||
485 | heavyiron | 221 | mcall |
260 | hidnplayr | 222 | |
223 | drawtherest_: |
||
224 | |||
225 | mov ebx, 240*65536+67 ; [x start] *65536 + [y start] |
||
226 | mov edx, connect ; pointer to text beginning |
||
227 | mov esi, connect_e-connect ; text length |
||
485 | heavyiron | 228 | mcall |
260 | hidnplayr | 229 | |
230 | popa |
||
231 | inc ebx |
||
485 | heavyiron | 232 | mcall |
260 | hidnplayr | 233 | |
234 | ret |
||
235 | |||
236 | |||
237 | ; DATA AREA |
||
485 | heavyiron | 238 | title db 'Kolibrios VNC client by HIDNPLAYR',0 |
260 | hidnplayr | 239 | |
240 | first: db '192.168.1.5' |
||
241 | rb STRLEN |
||
242 | second: rb STRLEN |
||
243 | |||
244 | passchar db '*' |
||
245 | passlen dd 0 |
||
246 | |||
247 | addr dd 0 |
||
248 | temp dd 0 |
||
249 | mode db 0 ; 0 = connection details, 1 = authentication |
||
250 | |||
251 | serverstr: db 'server:' |
||
252 | userstr: db 'username:' |
||
253 | passstr: db 'password:' |
||
254 | connect: db 'connect !' |
||
255 | connect_e: |
||
256 | |||
257 | I_END_logon:0> |