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