ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

endproc.c
Go to the documentation of this file.
00001 /*
00002  *  ReactOS Task Manager
00003  *
00004  *  endproc.c
00005  *
00006  *  Copyright (C) 1999 - 2001  Brian Palmer  <brianp@reactos.org>
00007  *                2005         Klemens Friedl <frik85@reactos.at>
00008  *
00009  * This library is free software; you can redistribute it and/or
00010  * modify it under the terms of the GNU Lesser General Public
00011  * License as published by the Free Software Foundation; either
00012  * version 2.1 of the License, or (at your option) any later version.
00013  *
00014  * This library is distributed in the hope that it will be useful,
00015  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00016  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00017  * Lesser General Public License for more details.
00018  *
00019  * You should have received a copy of the GNU Lesser General Public
00020  * License along with this library; if not, write to the Free Software
00021  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
00022  */
00023 
00024 #include <precomp.h>
00025 
00026 void ProcessPage_OnEndProcess(void)
00027 {
00028     DWORD   dwProcessId;
00029     HANDLE  hProcess;
00030     WCHAR   szTitle[256];
00031     WCHAR   strErrorText[260];
00032 
00033     dwProcessId = GetSelectedProcessId();
00034 
00035     if (dwProcessId == 0)
00036         return;
00037 
00038     LoadStringW(hInst, IDS_MSG_WARNINGTERMINATING, strErrorText, 256);
00039     LoadStringW(hInst, IDS_MSG_TASKMGRWARNING, szTitle, 256);
00040     if (MessageBoxW(hMainWnd, strErrorText, szTitle, MB_YESNO|MB_ICONWARNING) != IDYES)
00041         return;
00042 
00043     hProcess = OpenProcess(PROCESS_TERMINATE, FALSE, dwProcessId);
00044 
00045     if (!hProcess)
00046     {
00047         GetLastErrorText(strErrorText, 260);
00048         LoadStringW(hInst, IDS_MSG_UNABLETERMINATEPRO, szTitle, 256);
00049         MessageBoxW(hMainWnd, strErrorText, szTitle, MB_OK|MB_ICONSTOP);
00050         return;
00051     }
00052 
00053     if (!TerminateProcess(hProcess, 1))
00054     {
00055         GetLastErrorText(strErrorText, 260);
00056         LoadStringW(hInst, IDS_MSG_UNABLETERMINATEPRO, szTitle, 256);
00057         MessageBoxW(hMainWnd, strErrorText, szTitle, MB_OK|MB_ICONSTOP);
00058     }
00059 
00060     CloseHandle(hProcess);
00061 }
00062 
00063 void ProcessPage_OnEndProcessTree(void)
00064 {
00065     DWORD   dwProcessId;
00066     HANDLE  hProcess;
00067     WCHAR   szTitle[256];
00068     WCHAR   strErrorText[260];
00069 
00070     dwProcessId = GetSelectedProcessId();
00071 
00072     if (dwProcessId == 0)
00073         return;
00074 
00075     LoadStringW(hInst, IDS_MSG_WARNINGTERMINATING, strErrorText, 256);
00076     LoadStringW(hInst, IDS_MSG_TASKMGRWARNING, szTitle, 256);
00077     if (MessageBoxW(hMainWnd, strErrorText, szTitle, MB_YESNO|MB_ICONWARNING) != IDYES)
00078         return;
00079 
00080     hProcess = OpenProcess(PROCESS_TERMINATE, FALSE, dwProcessId);
00081 
00082     if (!hProcess)
00083     {
00084         GetLastErrorText(strErrorText, 260);
00085         LoadStringW(hInst, IDS_MSG_UNABLETERMINATEPRO, szTitle, 256);
00086         MessageBoxW(hMainWnd, strErrorText, szTitle, MB_OK|MB_ICONSTOP);
00087         return;
00088     }
00089 
00090     if (!TerminateProcess(hProcess, 0))
00091     {
00092         GetLastErrorText(strErrorText, 260);
00093         LoadStringW(hInst, IDS_MSG_UNABLETERMINATEPRO, szTitle, 256);
00094         MessageBoxW(hMainWnd, strErrorText, szTitle, MB_OK|MB_ICONSTOP);
00095     }
00096 
00097     CloseHandle(hProcess);
00098 }

Generated on Sat May 26 2012 04:16:28 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.