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