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