Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Fichiers
Recherche: 

Process Killer for VFP
Kevin Pirkl, Providence Health Plans
Source code for a DLL that will allow you to kill processes from within VFP. Code was written in C using the VFP libs. .PRG usage examples included.
Créé le
Il y a 23 années
Téléchargements
1182
Type de fichier
Résultat de votes
5.00/5.00
General information
Résultat de votes:
5.00/5.00 (1 rate) Évaluer cet item
Description
*-------------------------------------------------------------------------------------------* *- File : process.prg *- Date : 10/19/97 *- Description : For retrieving and/or terminating processes *- See task manager for a current list of running processes *- KILLPROCxx requires debug rights see "PSS ID Number: Q131065" below *- *- Author : Kevin M Pirkl ( kevinp@triweb.com) Trillium Software Inc *- *- Uses : PSAPI.DLL, PVIEW.FLL *- *- Functions in PSAPI.DLL *- Name Parameters Data Type Returns Return Descr *- -------------------------------------------------------------------- *- - For Information on PSAPI check the Win32 SDK or Article: "Under the Hood" *- in Microsoft Systems Journal 1996 Volume 11, August 1996 Number 8 *- *- Functions in PVIEW.FLL *- Name Parameters Data Type Returns Return Descr *- -------------------------------------------------------------------- *- PROCID ProcessName Character Integer The Process ID *- KILLPROCNM ProcessName Character Integer *Results Message *- KILLPROCID ProcessId Integer Integer *Results Message *- *- *Results Message *- -4 Cannot open the current running process to adjust privledges *- -3 Cannot adjust privledges for logged in user. Probably dont have debug rights *- -2 Cannot enumerate currently running processes *- -1 Process not found *- 0 Cannot Terminate the process *- 1 Process Terminated *- *- lets terminate Internet Information Server...(IIS) SET LIBRARY TO PVIEW && open the FLL file ? PROCID( "inetinfo.exe") && not case sensitive - Prints out the process ID ? PROCID( "ineTInf") && will also match with the first few chars ? KILLPROCNM( "inetinfo.exe") && kill IIS by name if you have rights ? KILLPROCID( PROCID( "inetinfo.exe")) && OR alternatly kill IIS by process id RETURN *-------------------------------------------------------------------------------------------* *!* Remarks on TerminateProcess - Taken from MS DevNet CD *!* *!* The TerminateProcess function is used to unconditionally cause a process to exit. *!* Use it only in extreme circumstances. The state of global data maintained *!* by dynamic-link libraries (DLLs) may be compromised if TerminateProcess *!* is used rather than ExitProcess. *!* *!* TerminateProcess causes all threads within a process to terminate, and causes *!* a process to exit, but DLLs attached to the process are not notified that *!* the process is terminating. *!* *!* Terminating a process causes the following: *!* *!* 1.All of the object handles opened by the process are closed. *!* 2.All of the threads in the process terminate their execution. *!* 3.The state of the process object becomes signaled, satisfying any *!* threads that had been waiting for the process to terminate. *!* 4.The states of all threads of the process become signaled, satisfying *!* any threads that had been waiting for the threads to terminate. *!* 5.The termination status of the process changes from STILL_ACTIVE *!* to the exit value of the process. *!* *!* Terminating a process does not cause child processes to be terminated. *!* *!* Terminating a process does not necessarily remove the process object *!* from the system. A process object is deleted when the last handle to the *!* process is closed. *!* *-------------------------------------------------------------------------------------------* *-------------------------------------------------------------------------------------------* *!* PSS ID Number: Q131065 *!* Article last modified on 09-25-1995 *!* *!* 3.10 3.50 3.51 *!* *!* WINDOWS NT *!* *!* *!* ------------------------------------------------------------------------- *!* The information in this article applies to: *!* *!* - Microsoft Win32 Application Programming Interface (API) included with: *!* *!* - Microsoft Windows NT versions 3.1, 3.5, and 3.51 *!* ------------------------------------------------------------------------- *!* *!* SUMMARY *!* ======= *!* *!* In Windows NT, you can retrieve a handle to any process in the system by *!* enabling the SeDebugPrivilege in the calling process. The calling process *!* can then call the OpenProcess() Win32 API to obtain a handle with *!* PROCESS_ALL_ACCESS. *!* *!* MORE INFORMATION *!* ================ *!* *!* This functionality is provided for system-level debugging purposes. For *!* debugging non-system processes, it is not necessary to grant or enable this *!* privilege. *!* *!* This privilege allows the caller all access to the process, including the *!* ability to call TerminateProcess(), CreateRemoteThread(), *!* and other potentially dangerous Win32 APIs on the target process. *!* *!* Take great care when granting SeDebugPrivilege to users or groups. *!* *!* Sample Code *!* ----------- *!* *!* The following source code illustrates how to obtain SeDebugPrivilege *!* in order to get a handle to a process with PROCESS_ALL_ACCESS. The *!* sample code then calls TerminateProcess on the resultant process *!* handle. *!* *!* /*++ *!* *!* The SeDebugPrivilege allows you to open any process for debugging purposes. *!* After enabling the privilege, you can open a target process by using *!* OpenProcess() with PROCESS_ALL_ACCESS. *!* *!* By default, this privilege is granted only to SYSTEM and the local *!* Administrators group. *!* *!* User Manager | Policies | User Rights | Show Advanced User Rights | Debug *!* Programs can be used to grant or revoke this privilege to arbitrary users *!* or groups. *!* *!* WARNING: This privilege allows all access to a process. A malevolent user *!* could open a system process, create a remote thread in the system process, *!* and execute code in the system security context. Great care must be used *!* when giving out this privilege *!* *!* --*/
Créé par
Kevin Pirkl, Providence Health Plans

Commentaires
Hi, This program has been very handy and useful. It saves a lot of coding. Thanks. Kezia Matthews, March 23, 2005

Ajouter un commentaire