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