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