Rev 7354 | Rev 8533 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
6444 | pathoswith | 1 | ;-----------------------; |
2 | ; CPU - process manager ; |
||
3 | ;-----------------------; |
||
4 | |||
3408 | hidnplayr | 5 | format binary as "" |
6 | |||
7 | use32 |
||
8 | org 0x0 |
||
9 | db 'MENUET01' ; 8 byte id |
||
10 | dd 0x01 ; header version |
||
11 | dd START ; start of code |
||
12 | dd IM_END ; size of image |
||
13 | dd U_END ; memory for app |
||
14 | dd stack_area ; esp |
||
15 | dd 0x0 ; boot parameters |
||
16 | dd 0x0 ; path |
||
2559 | mario79 | 17 | ;------------------------------------------------------------------------------ |
31 | halyavin | 18 | include 'lang.inc' |
1209 | diamond | 19 | include '../../../macros.inc' |
1373 | IgorA | 20 | include '../../../develop/libraries/box_lib/trunk/box_lib.mac' |
1209 | diamond | 21 | include '../../../develop/libraries/box_lib/load_lib.mac' |
2559 | mario79 | 22 | ;------------------------------------------------------------------------------ |
3408 | hidnplayr | 23 | display_processes=24 ;32 ; number of processes to show |
2559 | mario79 | 24 | window_x_size=524 |
25 | window_y_size=430 |
||
26 | ;------------------------------------------------------------------------------ |
||
3408 | hidnplayr | 27 | @use_library ;use load lib macros |
2559 | mario79 | 28 | ;------------------------------------------------------------------------------ |
3408 | hidnplayr | 29 | START: ; start of execution |
30 | mcall 68,11 |
||
1205 | Lrz | 31 | sys_load_library library_name, cur_dir_path, library_path, system_path, \ |
32 | err_message_found_lib, head_f_l, myimport, err_message_import, head_f_i |
||
3408 | hidnplayr | 33 | inc eax |
34 | jz close |
||
2559 | mario79 | 35 | ;------------------------------------------------------------------------------ |
3952 | mario79 | 36 | mcall 40,0x80000027 ;set event |
2559 | mario79 | 37 | ;------------------------------------------------------------------------------ |
38 | ;set window size and position for 0 function |
||
39 | ;to [winxpos] and [winypos] variables |
||
40 | ;get screen size |
||
3408 | hidnplayr | 41 | mcall 14 |
42 | mov ebx,eax |
||
3587 | fedesco | 43 | ;calculate (x_screen-window_x_size)/2 |
3408 | hidnplayr | 44 | shr ebx,16+1 |
45 | sub ebx,window_x_size/2 |
||
46 | shl ebx,16 |
||
47 | mov bx,window_x_size |
||
3587 | fedesco | 48 | ;winxpos=xcoord*65536+xsize |
3408 | hidnplayr | 49 | mov [winxpos],ebx |
3587 | fedesco | 50 | ;calculate (y_screen-window_y_size)/2 |
3408 | hidnplayr | 51 | and eax,0xffff |
52 | shr eax,1 |
||
53 | sub eax,window_y_size/2 |
||
54 | shl eax,16 |
||
55 | mov ax,window_y_size |
||
3587 | fedesco | 56 | ;winypos=ycoord*65536+ysize |
3408 | hidnplayr | 57 | mov [winypos],eax |
3587 | fedesco | 58 | ;------------------------------------------------------------------------------ |
3408 | hidnplayr | 59 | init_checkboxes2 check1,check1_end |
60 | mcall 48,3,sc,40 |
||
61 | edit_boxes_set_sys_color edit1,edit1_end,sc ;set color |
||
7519 | leency | 62 | ;check_boxes_set_sys_color2 check1,check1_end,sc ;set color |
2559 | mario79 | 63 | ;------------------------------------------------------------------------------ |
3587 | fedesco | 64 | align 4 |
65 | ;main loop when process name isn't edited. |
||
66 | red: |
||
3408 | hidnplayr | 67 | call draw_window ; redraw all window |
2559 | mario79 | 68 | ;------------------------------------------------------------------------------ |
3587 | fedesco | 69 | align 4 |
31 | halyavin | 70 | still: |
3408 | hidnplayr | 71 | mcall 23,100 ; wait here for event 1 sec. |
6444 | pathoswith | 72 | |
3955 | mario79 | 73 | test eax,eax |
74 | jz still_end |
||
31 | halyavin | 75 | |
3408 | hidnplayr | 76 | dec eax ; redraw request ? |
77 | jz red |
||
1205 | Lrz | 78 | |
3408 | hidnplayr | 79 | dec eax ; key in buffer ? |
80 | jz key |
||
2559 | mario79 | 81 | |
3408 | hidnplayr | 82 | dec eax ; button in buffer ? |
83 | jz button |
||
2559 | mario79 | 84 | |
3408 | hidnplayr | 85 | push dword edit1 |
86 | call [edit_box_mouse] |
||
3587 | fedesco | 87 | |
3408 | hidnplayr | 88 | push dword[check1.flags] |
3587 | fedesco | 89 | |
3408 | hidnplayr | 90 | push dword check1 |
91 | call [check_box_mouse] |
||
3587 | fedesco | 92 | |
3408 | hidnplayr | 93 | pop eax |
3587 | fedesco | 94 | |
3408 | hidnplayr | 95 | cmp eax, dword[check1.flags] |
96 | jz still_end |
||
3587 | fedesco | 97 | |
3408 | hidnplayr | 98 | push dword check1 |
99 | call [check_box_draw] |
||
2559 | mario79 | 100 | ;-------------------------------------- |
3587 | fedesco | 101 | align 4 |
102 | show_process_info_1: |
||
3408 | hidnplayr | 103 | mcall 26,9 |
104 | add eax,100 |
||
105 | mov [time_counter],eax |
||
1205 | Lrz | 106 | |
3408 | hidnplayr | 107 | call show_process_info ; draw new state of processes |
108 | jmp still |
||
2559 | mario79 | 109 | ;------------------------------------------------------------------------------ |
3587 | fedesco | 110 | align 4 |
2559 | mario79 | 111 | still_end: |
3408 | hidnplayr | 112 | mcall 26,9 |
113 | cmp [time_counter],eax |
||
114 | ja still |
||
31 | halyavin | 115 | |
3408 | hidnplayr | 116 | add eax,100 |
117 | mov [time_counter],eax |
||
1212 | Lrz | 118 | |
3408 | hidnplayr | 119 | call show_process_info ; draw new state of processes |
120 | jmp still |
||
2559 | mario79 | 121 | ;------------------------------------------------------------------------------ |
3587 | fedesco | 122 | align 4 |
3408 | hidnplayr | 123 | key: ; key |
124 | mcall 2 |
||
1205 | Lrz | 125 | |
3408 | hidnplayr | 126 | cmp ah,184 ; PageUp |
127 | jz pgdn |
||
1205 | Lrz | 128 | |
3408 | hidnplayr | 129 | cmp ah,183 |
130 | jz pgup ; PageDown |
||
2559 | mario79 | 131 | |
3408 | hidnplayr | 132 | cmp ah,27 |
133 | jz close ; Esc |
||
2559 | mario79 | 134 | |
3408 | hidnplayr | 135 | push dword edit1 |
136 | call [edit_box_key] |
||
137 | ; Check ENTER with ed_focus edit_box |
||
138 | lea edi,[edit1] |
||
139 | test word ed_flags,ed_focus |
||
3587 | fedesco | 140 | jz still_end |
1205 | Lrz | 141 | |
3408 | hidnplayr | 142 | sub ah,13 ; ENTER? |
143 | jz program_start ; RUN a program |
||
1212 | Lrz | 144 | |
3408 | hidnplayr | 145 | jmp still |
2559 | mario79 | 146 | ;------------------------------------------------------------------------------ |
3587 | fedesco | 147 | align 4 |
148 | button: |
||
149 | ; get button id |
||
3408 | hidnplayr | 150 | mcall 17 |
4968 | 0CodErr | 151 | mov bl, al ; save mouse button to bl |
3587 | fedesco | 152 | shr eax,8 |
31 | halyavin | 153 | ;id in [10,50] corresponds to terminate buttons. |
3408 | hidnplayr | 154 | cmp eax,10 |
3587 | fedesco | 155 | jb noterm |
31 | halyavin | 156 | |
3408 | hidnplayr | 157 | cmp eax,50 |
158 | jg noterm |
||
3587 | fedesco | 159 | ;calculate button index |
3408 | hidnplayr | 160 | sub eax,11 |
3587 | fedesco | 161 | ;calculate process slot |
3408 | hidnplayr | 162 | mov ecx,[tasklist+4*eax] |
31 | halyavin | 163 | ;ignore empty buttons |
3408 | hidnplayr | 164 | test ecx,ecx |
165 | jle still_end |
||
4968 | 0CodErr | 166 | test bl, bl ; check mouse button |
167 | jz .terminate |
||
168 | mov eax, ecx |
||
169 | mov edi, tinfo.params_buf |
||
170 | ;; number in eax |
||
171 | ;; buffer in edi |
||
172 | ; int2str: |
||
173 | push 0 |
||
174 | mov ecx, 10 |
||
6444 | pathoswith | 175 | .push: |
4968 | 0CodErr | 176 | xor edx, edx |
177 | div ecx |
||
178 | add edx, 48 |
||
179 | push edx |
||
6444 | pathoswith | 180 | test eax, eax |
4968 | 0CodErr | 181 | jnz .push |
6444 | pathoswith | 182 | .pop: |
4968 | 0CodErr | 183 | pop eax |
184 | stosb |
||
185 | test eax, eax |
||
186 | jnz .pop |
||
6444 | pathoswith | 187 | ; launch tinfo app |
4968 | 0CodErr | 188 | mov ebx, tinfo |
189 | mov eax, 70 |
||
190 | int 64 |
||
191 | jmp show_process_info_1 |
||
6444 | pathoswith | 192 | .terminate: |
3587 | fedesco | 193 | ;terminate application |
3408 | hidnplayr | 194 | mcall 18,2 |
3587 | fedesco | 195 | jmp show_process_info_1 |
2559 | mario79 | 196 | ;-------------------------------------- |
197 | align 4 |
||
198 | noterm: |
||
199 | ;special buttons |
||
3408 | hidnplayr | 200 | dec eax |
201 | jz close |
||
1212 | Lrz | 202 | |
3408 | hidnplayr | 203 | sub eax,50 |
204 | jz pgdn ;51 |
||
31 | halyavin | 205 | |
3408 | hidnplayr | 206 | dec eax |
207 | jz pgup ;52 |
||
1203 | Lrz | 208 | |
3408 | hidnplayr | 209 | dec eax |
210 | jz program_start ;53 |
||
1212 | Lrz | 211 | |
3408 | hidnplayr | 212 | dec eax |
213 | jz reboot ;54 |
||
1212 | Lrz | 214 | |
3408 | hidnplayr | 215 | jmp still_end |
3587 | fedesco | 216 | ;buttons handlers |
2559 | mario79 | 217 | ;------------------------------------------------------------------------------ |
3587 | fedesco | 218 | align 4 |
2559 | mario79 | 219 | pgdn: |
3408 | hidnplayr | 220 | sub [list_start],display_processes |
3587 | fedesco | 221 | jge show_process_info_1 |
3408 | hidnplayr | 222 | mov [list_start],0 |
223 | jmp show_process_info_1 |
||
2559 | mario79 | 224 | ;------------------------------------------------------------------------------ |
3587 | fedesco | 225 | align 4 |
2559 | mario79 | 226 | pgup: |
3408 | hidnplayr | 227 | mov eax,[list_add] ;maximal displayed process slot |
228 | mov [list_start],eax |
||
229 | jmp show_process_info_1 |
||
2559 | mario79 | 230 | ;------------------------------------------------------------------------------ |
3587 | fedesco | 231 | align 4 |
232 | program_start: |
||
3408 | hidnplayr | 233 | mcall 70,file_start |
234 | jmp show_process_info_1 |
||
2559 | mario79 | 235 | ;------------------------------------------------------------------------------ |
3587 | fedesco | 236 | align 4 |
237 | reboot: |
||
3408 | hidnplayr | 238 | mcall 70,sys_reboot |
31 | halyavin | 239 | ;close program if we going to reboot |
2559 | mario79 | 240 | ;------------------------------------------------------------------------------ |
3587 | fedesco | 241 | align 4 |
2559 | mario79 | 242 | close: |
3408 | hidnplayr | 243 | or eax,-1 ; close this program |
244 | mcall |
||
2559 | mario79 | 245 | ;------------------------------------------------------------------------------ |
3587 | fedesco | 246 | align 4 |
247 | draw_empty_slot: |
||
3408 | hidnplayr | 248 | cmp [draw_window_flag],1 |
249 | je @f |
||
250 | mov ecx,[curposy] |
||
251 | shl ecx,16 |
||
252 | mov cx,10 ; button height |
||
253 | mcall 13,<111,393>,,[bar_bacground_color] |
||
2582 | mario79 | 254 | @@: |
3408 | hidnplayr | 255 | ret |
2582 | mario79 | 256 | ;------------------------------------------------------------------------------ |
3587 | fedesco | 257 | align 4 |
31 | halyavin | 258 | draw_next_process: |
259 | ;input: |
||
260 | ; edi - current slot |
||
261 | ; [curposy] - y position |
||
262 | ;output: |
||
263 | ; edi - next slot (or -1 if no next slot) |
||
264 | ;registers corrupted! |
||
265 | ;create terminate process button |
||
3408 | hidnplayr | 266 | mov ecx,[curposy] |
267 | shl ecx,16 |
||
268 | mov cx,13 ; button height |
||
269 | mov edx,[index] |
||
270 | add edx,11 |
||
6444 | pathoswith | 271 | mov esi,0xccddee |
3408 | hidnplayr | 272 | test dword [index],1 |
6444 | pathoswith | 273 | jz @f |
274 | mov esi,0xaabbcc |
||
275 | @@: |
||
7354 | leency | 276 | add edx,0x80000000 ; delete a button |
277 | mcall 8 ; before create |
||
278 | sub edx,0x80000000 ; a new one below |
||
3408 | hidnplayr | 279 | mcall 8,<10,99> |
280 | mov [btn_bacground_color],esi |
||
31 | halyavin | 281 | ;draw background for proccess information |
6444 | pathoswith | 282 | mov edx,0xddffdd |
3408 | hidnplayr | 283 | test dword [index],1 |
6444 | pathoswith | 284 | jz @f |
285 | mov edx,0xffffff |
||
286 | @@: |
||
3408 | hidnplayr | 287 | inc cx |
288 | cmp [draw_window_flag],0 |
||
289 | je @f |
||
290 | mcall 13,<110,395> |
||
2582 | mario79 | 291 | @@: |
3408 | hidnplayr | 292 | mov [bar_bacground_color],edx |
6444 | pathoswith | 293 | ;nothing else should be done if there is no process for this button |
3408 | hidnplayr | 294 | cmp edi,-1 |
295 | jne .return_1 |
||
2582 | mario79 | 296 | |
3408 | hidnplayr | 297 | call draw_empty_slot |
298 | or edi,-1 |
||
299 | jmp .ret |
||
2559 | mario79 | 300 | ;-------------------------------------- |
301 | align 4 |
||
302 | .return_1: |
||
31 | halyavin | 303 | ;find process |
3408 | hidnplayr | 304 | inc edi |
3587 | fedesco | 305 | ;more comfortable register for next loop |
3408 | hidnplayr | 306 | mov ecx,edi |
3587 | fedesco | 307 | ;precacluate pointer to process buffer |
3408 | hidnplayr | 308 | mov ebx,process_info_buffer |
2559 | mario79 | 309 | ;-------------------------------------- |
310 | align 4 |
||
31 | halyavin | 311 | .find_loop: |
3408 | hidnplayr | 312 | cmp ecx,256 |
313 | jge .no_processes |
||
31 | halyavin | 314 | ;load process information in buffer |
3408 | hidnplayr | 315 | mcall 9 |
31 | halyavin | 316 | ;if current slot greater than maximal slot, |
3587 | fedesco | 317 | ;there is no more proccesses. |
3408 | hidnplayr | 318 | cmp ecx,eax |
319 | jg .no_processes |
||
3587 | fedesco | 320 | ;if slot state is equal to 9, it is empty. |
3408 | hidnplayr | 321 | cmp [process_info_buffer+process_information.slot_state],9 |
322 | jnz .process_found |
||
3587 | fedesco | 323 | |
3408 | hidnplayr | 324 | inc ecx |
325 | jmp .find_loop |
||
2559 | mario79 | 326 | ;-------------------------------------- |
327 | align 4 |
||
31 | halyavin | 328 | .no_processes: |
3408 | hidnplayr | 329 | call draw_empty_slot |
330 | or edi,-1 |
||
331 | ret |
||
2559 | mario79 | 332 | ;-------------------------------------- |
333 | align 4 |
||
31 | halyavin | 334 | .process_found: |
1266 | Lrz | 335 | ;check on/off check box |
3408 | hidnplayr | 336 | push edi |
337 | lea edi,[check1] |
||
338 | test dword ch_flags,ch_flag_en |
||
339 | pop edi |
||
3779 | mario79 | 340 | jnz .no_filter |
1266 | Lrz | 341 | |
3408 | hidnplayr | 342 | cmp dword [process_info_buffer+10],'ICON' |
3779 | mario79 | 343 | jnz @f |
344 | cmp dword [process_info_buffer+10+4],0 |
||
3587 | fedesco | 345 | jz .return_1 |
3779 | mario79 | 346 | @@: |
347 | cmp dword [process_info_buffer+10],'IDLE' |
||
348 | jnz @f |
||
349 | cmp dword [process_info_buffer+10+4],0 |
||
3408 | hidnplayr | 350 | jz .return_1 |
3779 | mario79 | 351 | @@: |
352 | cmp word [process_info_buffer+10],'OS' |
||
353 | jnz @f |
||
354 | cmp dword [process_info_buffer+10+2],0 |
||
355 | jz .return_1 |
||
356 | @@: |
||
3408 | hidnplayr | 357 | cmp byte [process_info_buffer+10],'@' |
358 | jz .return_1 |
||
2559 | mario79 | 359 | ;-------------------------------------- |
360 | align 4 |
||
3779 | mario79 | 361 | .no_filter: |
3408 | hidnplayr | 362 | mov edi,ecx |
363 | mov [list_add],ecx |
||
3587 | fedesco | 364 | ;get processor cpeed |
31 | halyavin | 365 | ;for percent calculating |
3408 | hidnplayr | 366 | mcall 18,5 |
367 | xor edx,edx |
||
368 | mov ebx,100 |
||
369 | div ebx |
||
31 | halyavin | 370 | ;eax = number of operation for 1% now |
371 | ;calculate process cpu usage percent |
||
3408 | hidnplayr | 372 | mov ebx,eax |
373 | mov eax,[process_info_buffer+process_information.cpu_usage] |
||
374 | ; cdq |
||
3587 | fedesco | 375 | xor edx,edx ; for CPU more 2 GHz - mike.dld |
3408 | hidnplayr | 376 | div ebx |
377 | mov [cpu_percent],eax |
||
31 | halyavin | 378 | ;set text color to display process information |
3587 | fedesco | 379 | ;0% : black |
31 | halyavin | 380 | ;1-80% : green |
381 | ;81-100% : red |
||
3408 | hidnplayr | 382 | test eax,eax |
383 | jnz .no_black |
||
1212 | Lrz | 384 | |
6444 | pathoswith | 385 | mov esi,eax |
3408 | hidnplayr | 386 | jmp .color_set |
2559 | mario79 | 387 | ;-------------------------------------- |
388 | align 4 |
||
3587 | fedesco | 389 | .no_black: |
3408 | hidnplayr | 390 | cmp eax,80 |
391 | ja .no_green |
||
1212 | Lrz | 392 | |
6444 | pathoswith | 393 | mov esi,0x107a30 |
3408 | hidnplayr | 394 | jmp .color_set |
2559 | mario79 | 395 | ;-------------------------------------- |
396 | align 4 |
||
31 | halyavin | 397 | .no_green: |
6444 | pathoswith | 398 | mov esi,0xac0000 |
2559 | mario79 | 399 | ;-------------------------------------- |
400 | align 4 |
||
31 | halyavin | 401 | .color_set: |
402 | ;show slot number |
||
3587 | fedesco | 403 | ;ecx haven't changed since .process_found |
3408 | hidnplayr | 404 | push edi |
405 | mov edx,[curposy] |
||
406 | add edx,15*65536+3 |
||
6444 | pathoswith | 407 | mcall 47,<2,256> |
31 | halyavin | 408 | ;show process name |
3408 | hidnplayr | 409 | mov ebx,[curposy] |
410 | add ebx,40*65536+3 |
||
6444 | pathoswith | 411 | mov ecx,esi |
412 | mcall 4,,,process_info_buffer.process_name,11 |
||
31 | halyavin | 413 | ;show pid |
3408 | hidnplayr | 414 | mov edx,[curposy] |
415 | add edx,125*65536+3 |
||
6444 | pathoswith | 416 | mov esi,ecx |
3408 | hidnplayr | 417 | or esi,0x40000000 |
418 | mcall 47,<8,256>,[process_info_buffer.PID],,,[bar_bacground_color] |
||
31 | halyavin | 419 | ;show cpu usage |
3408 | hidnplayr | 420 | add edx,60*65536 |
421 | mcall ,,[process_info_buffer.cpu_usage] |
||
31 | halyavin | 422 | ;show cpu percent |
3408 | hidnplayr | 423 | add edx,60*65536 |
424 | mcall ,<3,0>,[cpu_percent] |
||
31 | halyavin | 425 | ;show memory start - obsolete |
3408 | hidnplayr | 426 | add edx,30*65536 |
427 | mcall ,<8,256>,[process_info_buffer.memory_start] |
||
31 | halyavin | 428 | ;show memory usage |
3408 | hidnplayr | 429 | mov ecx,[process_info_buffer.used_memory] |
430 | inc ecx |
||
431 | add edx,60*65536 |
||
432 | mcall |
||
31 | halyavin | 433 | ;show window stack and value |
3408 | hidnplayr | 434 | add edx,60*65536 |
435 | mcall ,,dword [process_info_buffer.window_stack_position] |
||
31 | halyavin | 436 | ;show window xy size |
3408 | hidnplayr | 437 | mov ecx,[process_info_buffer.box.left] |
438 | shl ecx,16 |
||
439 | add ecx,[process_info_buffer.box.top] |
||
440 | add edx,60*65536 |
||
3587 | fedesco | 441 | mcall |
3408 | hidnplayr | 442 | pop edi |
2559 | mario79 | 443 | ;-------------------------------------- |
444 | align 4 |
||
31 | halyavin | 445 | .ret: |
446 | ;build index->slot map for terminating processes. |
||
3408 | hidnplayr | 447 | mov eax,[index] |
3587 | fedesco | 448 | mov [tasklist+4*eax],edi |
3408 | hidnplayr | 449 | ret |
2559 | mario79 | 450 | ;------------------------------------------------------------------------------ |
3587 | fedesco | 451 | align 4 |
2559 | mario79 | 452 | f11: |
3587 | fedesco | 453 | ;full update |
3408 | hidnplayr | 454 | push edi |
455 | call draw_window |
||
456 | pop edi |
||
2559 | mario79 | 457 | ;------------------------------------------------------------------------------ |
31 | halyavin | 458 | ; ********************************************* |
459 | ; ******* WINDOW DEFINITIONS AND DRAW ******** |
||
460 | ; ********************************************* |
||
3587 | fedesco | 461 | align 4 |
31 | halyavin | 462 | draw_window: |
3587 | fedesco | 463 | mcall 12, 1 |
2559 | mario79 | 464 | ; DRAW WINDOW |
3408 | hidnplayr | 465 | xor eax,eax ; function 0 : define and draw window |
466 | xor esi,esi |
||
467 | mcall ,[winxpos],[winypos],0x74ffffff,,title ;0x34ddffdd |
||
2582 | mario79 | 468 | |
3408 | hidnplayr | 469 | mcall 9,process_info_buffer,-1 |
3587 | fedesco | 470 | |
3408 | hidnplayr | 471 | mov eax,[ebx+70] |
472 | mov [window_status],eax |
||
473 | test [window_status],100b ; window is rolled up |
||
474 | jnz .exit |
||
2583 | mario79 | 475 | |
3408 | hidnplayr | 476 | test [window_status],10b ; window is minimized to panel |
477 | jnz .exit |
||
2583 | mario79 | 478 | |
3408 | hidnplayr | 479 | mov eax,[ebx+62] |
480 | inc eax |
||
481 | mov [client_area_x_size],eax |
||
482 | mov eax,[ebx+66] |
||
483 | inc eax |
||
484 | mov [client_area_y_size],eax |
||
2582 | mario79 | 485 | |
3408 | hidnplayr | 486 | mov ebx,[client_area_x_size] |
487 | mcall 13,,<0,20>,0xffffff |
||
2559 | mario79 | 488 | ; function 4 : write text to window |
3408 | hidnplayr | 489 | xor ecx,ecx |
490 | mcall 4,<17,8>,,text,text_len |
||
31 | halyavin | 491 | |
3408 | hidnplayr | 492 | mcall 13,<0,10>,<20,336>,0xffffff |
3587 | fedesco | 493 | |
3408 | hidnplayr | 494 | mov ebx,[client_area_x_size] |
495 | sub ebx,10+100+395 |
||
496 | add ebx,(10+100+395) shl 16 |
||
497 | mcall |
||
3587 | fedesco | 498 | |
3408 | hidnplayr | 499 | mcall 26,9 |
500 | add eax,100 |
||
501 | mov [time_counter],eax |
||
2582 | mario79 | 502 | |
3408 | hidnplayr | 503 | mov [draw_window_flag],1 |
504 | call show_process_info |
||
505 | mov [draw_window_flag],0 |
||
3587 | fedesco | 506 | |
3408 | hidnplayr | 507 | mov ebx,[client_area_x_size] |
508 | mov ecx,[client_area_y_size] |
||
509 | sub ecx,20+336 |
||
510 | add ecx,(20+336) shl 16 |
||
511 | mcall 13,,,0xffffff |
||
2582 | mario79 | 512 | |
3408 | hidnplayr | 513 | push dword edit1 |
514 | call [edit_box_draw] |
||
2559 | mario79 | 515 | |
3408 | hidnplayr | 516 | push dword check1 |
517 | call [check_box_draw] |
||
3587 | fedesco | 518 | |
31 | halyavin | 519 | ; previous page button |
3408 | hidnplayr | 520 | mcall 8,<25,96>,<361,14>,51,0xccddee ;0xaabbcc |
1207 | Lrz | 521 | ; next page button 52 |
3408 | hidnplayr | 522 | inc edx |
523 | mcall ,<125,96> |
||
31 | halyavin | 524 | ; ">" (text enter) button |
3408 | hidnplayr | 525 | add ecx,20 shl 16 |
1207 | Lrz | 526 | ; run button 53 |
3408 | hidnplayr | 527 | inc edx |
528 | mcall ,<456,50> |
||
3587 | fedesco | 529 | ; reboot button |
530 | sub ebx,120*65536 |
||
3408 | hidnplayr | 531 | add ebx,60 |
532 | sub ecx,20 shl 16 |
||
533 | inc edx |
||
534 | mcall |
||
31 | halyavin | 535 | ;"PREV PAGE", "NEXT PAGE" and "REBOOT" labels |
3408 | hidnplayr | 536 | xor ecx,ecx |
537 | mcall 4,<45,365>,,tbts,tbte-tbts |
||
31 | halyavin | 538 | ;"RUN" labels |
3408 | hidnplayr | 539 | mcall ,<464,385>,,tbts_3,tbte_2-tbts_3 |
31 | halyavin | 540 | ;print application name in text box |
2583 | mario79 | 541 | ;-------------------------------------- |
542 | align 4 |
||
543 | .exit: |
||
3408 | hidnplayr | 544 | mcall 12, 2 |
545 | ret |
||
2559 | mario79 | 546 | ;------------------------------------------------------------------------------ |
547 | align 4 |
||
548 | show_process_info: |
||
3408 | hidnplayr | 549 | test [window_status],100b ; window is rolled up |
550 | jnz .exit |
||
2583 | mario79 | 551 | |
3408 | hidnplayr | 552 | test [window_status],10b ; window is minimized to panel |
553 | jnz .exit |
||
2583 | mario79 | 554 | |
3938 | mario79 | 555 | mov ecx,display_processes |
556 | mov edi,tasklist |
||
557 | xor eax,eax |
||
558 | cld |
||
559 | rep stosd |
||
560 | |||
3408 | hidnplayr | 561 | mov edi,[list_start] |
562 | mov [list_add],edi |
||
563 | mov dword [index],0 |
||
564 | mov dword [curposy],20 |
||
2559 | mario79 | 565 | ;-------------------------------------- |
566 | align 4 |
||
567 | .loop_draw: |
||
3408 | hidnplayr | 568 | call draw_next_process |
569 | inc dword [index] |
||
570 | add dword [curposy],14 |
||
571 | cmp [index],display_processes |
||
572 | jl .loop_draw |
||
2583 | mario79 | 573 | ;-------------------------------------- |
574 | align 4 |
||
575 | .exit: |
||
3408 | hidnplayr | 576 | ret |
2559 | mario79 | 577 | ;------------------------------------------------------------------------------ |
31 | halyavin | 578 | ; DATA AREA |
2559 | mario79 | 579 | ;------------------------------------------------------------------------------ |
3408 | hidnplayr | 580 | system_path db '/sys/lib/' |
581 | library_name db 'box_lib.obj',0 |
||
1205 | Lrz | 582 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
583 | |||
3408 | hidnplayr | 584 | err_message_found_lib db 'Sorry I cannot load library box_lib.obj',0 |
1205 | Lrz | 585 | head_f_i: |
3408 | hidnplayr | 586 | head_f_l db 'System error',0 |
587 | err_message_import db 'Error on load import library box_lib.obj',0 |
||
2559 | mario79 | 588 | ;------------------------------------------------------------------------------ |
3587 | fedesco | 589 | align 4 |
590 | myimport: |
||
3408 | hidnplayr | 591 | edit_box_draw dd aEdit_box_draw |
592 | edit_box_key dd aEdit_box_key |
||
593 | edit_box_mouse dd aEdit_box_mouse |
||
594 | ;version_ed dd aVersion_ed |
||
1205 | Lrz | 595 | |
3408 | hidnplayr | 596 | init_checkbox dd aInit_checkbox |
597 | check_box_draw dd aCheck_box_draw |
||
598 | check_box_mouse dd aCheck_box_mouse |
||
599 | ;version_ch dd aVersion_ch |
||
1205 | Lrz | 600 | |
3408 | hidnplayr | 601 | ;option_box_draw dd aOption_box_draw |
602 | ;option_box_mouse dd aOption_box_mouse |
||
603 | ;version_op dd aVersion_op |
||
1205 | Lrz | 604 | |
3408 | hidnplayr | 605 | dd 0 |
606 | dd 0 |
||
1205 | Lrz | 607 | |
3408 | hidnplayr | 608 | aEdit_box_draw db 'edit_box',0 |
609 | aEdit_box_key db 'edit_box_key',0 |
||
610 | aEdit_box_mouse db 'edit_box_mouse',0 |
||
611 | ;aVersion_ed db 'version_ed',0 |
||
1205 | Lrz | 612 | |
3408 | hidnplayr | 613 | aInit_checkbox db 'init_checkbox2',0 |
614 | aCheck_box_draw db 'check_box_draw2',0 |
||
615 | aCheck_box_mouse db 'check_box_mouse2',0 |
||
616 | ;aVersion_ch db 'version_ch',0 |
||
1205 | Lrz | 617 | |
3408 | hidnplayr | 618 | ;aOption_box_draw db 'option_box_draw',0 |
619 | ;aOption_box_mouse db 'option_box_mouse',0 |
||
620 | ;aVersion_op db 'version_op',0 |
||
2559 | mario79 | 621 | ;------------------------------------------------------------------------------ |
3587 | fedesco | 622 | align 4 |
7519 | leency | 623 | check1 check_box2 (10 shl 16)+12,(383 shl 16)+12,6, 0x80D6DEE7,0x4C5258,0,check_text, ch_flag_middle ;ch_flag_en |
1266 | Lrz | 624 | check1_end: |
2582 | mario79 | 625 | edit1 edit_box 350,95,381,0xffffff,0x6f9480,0,0xAABBCC,0,start_application_c,\ |
2559 | mario79 | 626 | start_application,mouse_dd,ed_focus,start_application_e,start_application_e |
1228 | Lrz | 627 | edit1_end: |
31 | halyavin | 628 | list_start dd 0 |
2559 | mario79 | 629 | ;------------------------------------------------------------------------------ |
3587 | fedesco | 630 | align 4 |
748 | heavyiron | 631 | sys_reboot: |
3408 | hidnplayr | 632 | dd 7 |
633 | dd 0 |
||
634 | dd 0 |
||
635 | dd 0 |
||
636 | dd 0 |
||
637 | db '/sys/end',0 |
||
2559 | mario79 | 638 | ;------------------------------------------------------------------------------ |
340 | heavyiron | 639 | if lang eq de |
31 | halyavin | 640 | text: |
3408 | hidnplayr | 641 | db 'NAME/BEENDEN PID CPU-LAST % ' |
642 | db 'SPEICHER START/NUTZUNG W-STACK W-POS' |
||
205 | heavyiron | 643 | text_len = $-text |
31 | halyavin | 644 | |
3408 | hidnplayr | 645 | tbts: db 'SEITE ZURUECK SEITE VOR REBOOT SYSTEM' |
135 | diamond | 646 | tbte: |
3408 | hidnplayr | 647 | tbts_3 db 'START' |
135 | diamond | 648 | tbte_2: |
5420 | leency | 649 | check_text db 'System',0 |
3408 | hidnplayr | 650 | title db 'Prozesse - Ctrl/Alt/Del',0 |
2559 | mario79 | 651 | ;-------------------------------------- |
268 | kaitz | 652 | else if lang eq et |
653 | text: |
||
3408 | hidnplayr | 654 | db 'NIMI/LÕPETA PID CPU-KASUTUS % ' |
655 | db 'MÄLU ALGUS/KASUTUS W-PUHVER W-SUURUS' |
||
268 | kaitz | 656 | text_len = $-text |
657 | |||
3408 | hidnplayr | 658 | tbts: db 'EELMINE LEHT JÄRGMINE LEHT REBOODI SÜSTEEM' |
268 | kaitz | 659 | tbte: |
3408 | hidnplayr | 660 | tbts_3 db 'START' |
268 | kaitz | 661 | tbte_2: |
5420 | leency | 662 | check_text db 'System',0 |
3408 | hidnplayr | 663 | title db 'Protsessid - Ctrl/Alt/Del' |
2559 | mario79 | 664 | ;-------------------------------------- |
665 | else if lang eq ru |
||
666 | text: |
||
3408 | hidnplayr | 667 | db 'ˆŒŸ/‡€‚…˜ˆ’œ PID CPU-‡€ƒ“‡Š€ % ' |
668 | db '€ŒŸ’œ €—€‹Ž/‚‘…ƒŽ W-STACK W-POS' |
||
2559 | mario79 | 669 | text_len = $-text |
268 | kaitz | 670 | |
3408 | hidnplayr | 671 | tbts: db '…„.‘’ ‘‹…„.‘’ ……‡€ƒ“‡Š€' |
2559 | mario79 | 672 | tbte: |
3408 | hidnplayr | 673 | tbts_3 db '‡€“‘Š' |
2559 | mario79 | 674 | tbte_2: |
5420 | leency | 675 | check_text db '‘¨á⥬ë¥',0 |
3408 | hidnplayr | 676 | title db '„¨á¯¥âç¥à ¯à®æ¥áᮢ - Ctrl/Alt/Del',0 |
2559 | mario79 | 677 | ;-------------------------------------- |
3587 | fedesco | 678 | else if lang eq it |
679 | text: |
||
680 | db 'NOME-PROGRAMMA PID USO CPU % ' |
||
681 | db 'MEMORY START/USAGE W-STACK W-POS' |
||
682 | text_len = $-text |
||
683 | |||
684 | tbts: db 'INDIETRO AVANTI RIAVVIA SISTEMA' |
||
685 | tbte: |
||
686 | tbts_3 db 'START' |
||
687 | tbte_2: |
||
5420 | leency | 688 | check_text db 'System',0 |
3587 | fedesco | 689 | title db 'Gestore processi - Ctrl/Alt/Del',0 |
690 | ;-------------------------------------- |
||
340 | heavyiron | 691 | else |
692 | text: |
||
3408 | hidnplayr | 693 | db 'NAME/TERMINATE PID CPU-USAGE % ' |
694 | db 'MEMORY START/USAGE W-STACK W-POS' |
||
340 | heavyiron | 695 | text_len = $-text |
696 | |||
3408 | hidnplayr | 697 | tbts: db 'PREV PAGE NEXT PAGE REBOOT SYSTEM' |
340 | heavyiron | 698 | tbte: |
3408 | hidnplayr | 699 | tbts_3 db ' RUN' |
340 | heavyiron | 700 | tbte_2: |
5420 | leency | 701 | check_text db 'System',0 |
3408 | hidnplayr | 702 | title db 'Process manager - Ctrl/Alt/Del',0 |
340 | heavyiron | 703 | |
135 | diamond | 704 | end if |
4968 | 0CodErr | 705 | ; ---------------------------------------------------------------------------- ; |
3587 | fedesco | 706 | align 4 |
4968 | 0CodErr | 707 | tinfo: |
708 | dd 7 |
||
709 | dd 0 |
||
710 | .params dd .params_buf |
||
711 | dd 0 |
||
712 | dd 0 |
||
713 | db 0 |
||
714 | .file_path dd sz_tinfo_file_path |
||
715 | align 4 |
||
716 | .params_buf: |
||
717 | times 11 db 0 ; at now 4 bytes will be enough, but may be in the future not |
||
718 | align 4 |
||
719 | sz_tinfo_file_path db "/sys/tinfo",0 |
||
720 | ; ---------------------------------------------------------------------------- ; |
||
721 | align 4 |
||
2559 | mario79 | 722 | file_start: |
3408 | hidnplayr | 723 | dd 7 |
724 | dd 0 |
||
725 | dd 0 |
||
726 | dd 0 |
||
727 | dd 0 |
||
5427 | yogev_ezra | 728 | start_application: db '/sys/LAUNCHER',0 |
1205 | Lrz | 729 | start_application_e=$-start_application-1 |
730 | ; times 60 db 0 |
||
3408 | hidnplayr | 731 | rb 60 |
1205 | Lrz | 732 | start_application_c=$-start_application-1 |
2559 | mario79 | 733 | ;------------------------------------------------------------------------------ |
734 | IM_END: |
||
735 | ;------------------------------------------------------------------------------ |
||
3587 | fedesco | 736 | align 4 |
1228 | Lrz | 737 | sc system_colors |
3408 | hidnplayr | 738 | winxpos rd 1 |
739 | winypos rd 1 |
||
740 | mouse_dd rd 1 |
||
741 | cpu_percent rd 1 |
||
742 | list_add rd 1 |
||
743 | curposy rd 1 |
||
744 | index rd 1 |
||
745 | tasklist rd display_processes |
||
746 | time_counter rd 1 |
||
2582 | mario79 | 747 | |
3408 | hidnplayr | 748 | window_status rd 1 |
749 | client_area_x_size rd 1 |
||
750 | client_area_y_size rd 1 |
||
751 | bar_bacground_color rd 1 |
||
752 | btn_bacground_color rd 1 |
||
753 | draw_window_flag rd 1 |
||
2559 | mario79 | 754 | ;------------------------------------------------------------------------------ |
3587 | fedesco | 755 | align 4 |
2559 | mario79 | 756 | library_path: |
31 | halyavin | 757 | process_info_buffer process_information |
2559 | mario79 | 758 | ;------------------------------------------------------------------------------ |
3587 | fedesco | 759 | align 4 |
2559 | mario79 | 760 | cur_dir_path: |
3408 | hidnplayr | 761 | rb 1024 |
762 | rb 1024 |
||
2559 | mario79 | 763 | stack_area: |
31 | halyavin | 764 | U_END:464,385>45,365>456,50>125,96>361,14>25,96>20,336>0,10>17,8>0,20>8,256>3,0>8,256>2,256>110,395>10,99>111,393> |