.386
.model flat,stdcall
option casemap:none
include windows.inc
include user32.inc
include kernel32.inc
includelib user32.lib
includelib kernel32.lib
DLG_MAIN  equ 1000
IDC_LIST equ  1001
IDC_STOP equ 1002
IDC_ABOUT equ 1003
IDC_REFRESH equ 1004
DlgProc proto :DWORD,:DWORD,:DWORD,:DWORD
_GetProcessList Proto :DWord
.Const
szerr DB 'can not close process', 0
.Data?
hwinlist DD ?
hInst HINSTANCE ?
.Code
_GetProcessList Proc _hwnd
Local @stprocess:PROCESSENTRY32
Local @hsnapshot
Invoke RtlZeroMemory, Addr @stprocess, SizeOf @stprocess
Invoke SendMessage, hwinlist, LB_RESETCONTENT, 0, 0
Mov @stprocess.dwSize, SizeOf @stprocess
Invoke CreateToolhelp32Snapshot, TH32CS_SNAPPROCESS, 0
Mov @hsnapshot, Eax
Invoke Process32First, @hsnapshot, Addr @stprocess
.While Eax
Invoke SendMessage, hwinlist, LB_ADDSTRING, 0, Addr @stprocess.szExeFile
Invoke SendMessage, hwinlist, LB_SETITEMDATA, Eax, @stprocess.th32ProcessID
Invoke Process32Next, @hsnapshot, Addr @stprocess
.EndW
Invoke CloseHandle, @hsnapshot
Invoke GetDlgItem, _hwnd, IDC_STOP
Invoke EnableWindow, Eax, FALSE
Ret
_GetProcessList EndP
DlgProc Proc hWnd:HWND, uMsg:UINT, wParam:WPARAM, lParam:LPARAM
Mov Eax, uMsg
.If Eax == WM_CLOSE
Invoke EndDialog, hWnd, NULL
.ElseIf Eax == WM_INITDIALOG
Invoke GetDlgItem, hWnd, IDC_LIST
Mov hwinlist, Eax
Invoke _GetProcessList, hWnd
.ElseIf Eax == WM_COMMAND
Mov Eax, wParam
.If Ax == IDC_STOP
Invoke SendMessage, hwinlist, LB_GETCURSEL, 0, 0
Invoke SendMessage, hwinlist, LB_GETITEMDATA, Eax, 0
Invoke OpenProcess, PROCESS_TERMINATE, FALSE, Eax
                                          .If Eax
  Mov Ebx, Eax
  Invoke TerminateProcess, Ebx, 0
  Invoke CloseHandle, Ebx
  Invoke Sleep, 200
  Invoke _GetProcessList, hWnd
 
              .else
                    Invoke MessageBox, hWnd, Addr szerr, NULL, MB_OK Or MB_ICONWARNING
                                                          .endif
        .ElseIf Ax == IDC_REFRESH
        Invoke _GetProcessList, hWnd
        .ElseIf Ax == IDC_LIST
        Shr Eax, 16
        .If Ax == LBN_SELCHANGE
        Invoke GetDlgItem, hWnd, IDC_STOP
        Invoke EnableWindow, Eax, TRUE
        .EndIf
        .EndIf

    .Else
    Mov Eax, FALSE
    Ret
    .EndIf
    Mov Eax, TRUE
    Ret
DlgProc EndP
start:
Invoke GetModuleHandle, NULL
    Mov hInst, Eax
Invoke DialogBoxParam, hInst, DLG_MAIN, NULL, Offset DlgProc, NULL
Invoke ExitProcess, Eax
End start

this is process manager,but when I use it kill another process,it show a mistike,then exit
meaning of error is:program error
                          *.exe make a mistake,the windows will close it ,program need restart
why?

                     

       
Posted on 2005-05-18 02:48:52 by 55crazy
Compile and link your application to contain debugging info and use debugger to find out where in the code the crash occurs.
Posted on 2005-05-18 03:32:28 by thefox
Has any error in my code?
which debugger I can use?
how can I use debugger in radasm?
Posted on 2005-05-18 04:11:50 by 55crazy
It would be easier if you post an exe. Regarding the debugger, go download Ollydbg from http://home.t-online.de/home/Ollydbg/.
Posted on 2005-05-18 06:48:39 by roticv
I skimmed through your program VERY briefly - and it seems like you're using EBX without preserving it. That's a no-no.
Posted on 2005-05-18 07:32:08 by f0dder
Hi f0dder
yes! It's ok!you are very good!
 
.If Eax
                push ebx
Mov Ebx, Eax
Invoke TerminateProcess, Ebx, 0
Invoke CloseHandle, Ebx
                pop ebx
Invoke Sleep, 200
Invoke _GetProcessList, hWnd

Posted on 2005-05-18 22:33:20 by 55crazy