Download code

Jump to: navigation, search

Back to Tasklist_(Windows)

Download for Windows: single file, zip

Download for UNIX: single file, zip, tar.gz, tar.bz2

tasklist.c

 1 /* The authors of this work have released all rights to it and placed it
 2 in the public domain under the Creative Commons CC0 1.0 waiver
 3 (http://creativecommons.org/publicdomain/zero/1.0/).
 4 
 5 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
 6 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 7 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
 8 IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
 9 CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
10 TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
11 SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
12 
13 Retrieved from: http://en.literateprograms.org/Tasklist_(Windows)?oldid=4223
14 */
15 
16 
17 #include <windows.h>
18 #include <Tlhelp32.h>
19 #include <stdio.h>
20 
21 //------------------------------------------------------------------------------------------------------------------
22 // printtasklist()
23 //
24 // prints a list over all tasks in the system
25 //------------------------------------------------------------------------------------------------------------------
26 
27 void printtasklist(void)
28 {
29   HANDLE          hSnapshot;
30   BOOL            success;
31   PROCESSENTRY32  lppe;
32 
33   hSnapshot = CreateToolhelp32Snapshot(TH32CS_SNAPALL,0);
34 
35   if(hSnapshot)
36   {
37     lppe.dwSize = (sizeof(PROCESSENTRY32));
38 
39     success = Process32First(hSnapshot,&lppe);
40     if(success)
41     {
42       do
43       {
44         printf("%s\n",lppe.szExeFile);
45       }
46       while(Process32Next(hSnapshot,&lppe));
47     }
48     CloseHandle(hSnapshot);
49   }
50   return;
51 }
52 
53 //------------------------------------------------------------------------------------------------------------------
54 // Entry point...
55 //------------------------------------------------------------------------------------------------------------------
56 
57 int main(void)
58 {
59   printtasklist();
60 
61   return 0;
62 }
63 
64 


hijacker
hijacker
hijacker
hijacker

build.log

1 /tmp/litprog7237091/tasklist.c:17:21: fatal error: windows.h: No such file or directory
2 compilation terminated.