Terminating Proccesses

This is a discussion on Terminating Proccesses within the C++ Programming forums, part of the General Programming Boards category; sometimes when im testing my hacks the game window freezes so im trying to make a program that terminates the ...

  1. #1
    Banned
    Join Date
    Oct 2004
    Posts
    250

    Terminating Proccesses

    sometimes when im testing my hacks the game window freezes so im trying to make a program that terminates the process
    Code:
    #include <tlhelp32.h> 
    int main()
    {
     HANDLE SnapShot = CreateToolhelp32Snapshot(TH32CS_SNAPALL,NULL); 
       if (SnapShot != NULL) 
       { 
                       PROCESSENTRY32 PE; 
          PE.dwSize = sizeof(PROCESSENTRY32); 
          HRESULT r = Process32First (SnapShot,&PE); 
          while(r != NULL) 
          { 
             if(strstr((char*)&PE.szExeFile,"globalops.exe") ) 
             { 
                HANDLE GO = OpenProcess (PROCESS_TERMINATE,0,PE.th32ProcessID); 
                      TerminateProcess (GO,0); 
             } 
             r = Process32Next (SnapShot,&PE); 
          } 
       } 
    }
    how would i fix these errors
    Code:
    Compiling...
    main.cpp
    c:\program files\microsoft visual studio\vc98\include\tlhelp32.h(26) : error C2146: syntax error : missing ';' before identifier 'WINAPI'
    c:\program files\microsoft visual studio\vc98\include\tlhelp32.h(26) : error C2501: 'HANDLE' : missing storage-class or type specifiers
    c:\program files\microsoft visual studio\vc98\include\tlhelp32.h(26) : fatal error C1004: unexpected end of file found
    Error executing cl.exe.

  2. #2
    & the hat of GPL slaying Thantos's Avatar
    Join Date
    Sep 2001
    Posts
    5,681
    Heres a hint: Its around line 26 of the header file

  3. #3
    Banned
    Join Date
    Oct 2004
    Posts
    250
    wtf a error with a precompiled header file how am i supposed to fix that

  4. #4
    Registered User
    Join Date
    Mar 2002
    Posts
    1,595
    It's not likely to be a problem with the code in the tlhelp32 file as such, but with the syntax the function/whatever, at line 26 is expecting, and not getting. In particular, I suspect the problem is that tlhelp32 is a windows header and is expecting something from a windows file that it's not getting. Maybe you need to include the windows.h file if you are trying to use windows functions in a console program, but I think it more likely that you are attempting to write a windows program but are using the console entry point int main() rather than a windows entry point like int WINAPI WinMain(). Telling us what type of program you are trying to write will help us help you better.

  5. #5
    &TH of undefined behavior Fordy's Avatar
    Join Date
    Aug 2001
    Posts
    5,789
    Most likely elad had it right with "Maybe you need to include the windows.h file".

    HANDLE is a windows defined typedef and is unrecognised without windows.h.

  6. #6
    Registered User
    Join Date
    Jun 2004
    Posts
    722
    Hum, 1st you wanted to hide task manager, then you wanted to delete registry keys,now you want to end processes, but as I can see your having serious trouble programmming, so I believe your little worm or whatever wont affect anyone. But it should be interesting learning basics about programming using a high-level API. 1st I advise you to learn to read and understand compiler warnings... Anyway good luck
    Last edited by xErath; 11-15-2004 at 07:15 PM.

  7. #7
    Banned
    Join Date
    Oct 2004
    Posts
    250
    no i dont want to write a virus ...
    im just trying to find a way to hide some programs from being detected by an anti cheat
    everyone has to start from somewhere i have only been programming for 2 months and since i am only 10 i think i am doing well

  8. #8
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,702
    You should be outside playing with friends instead of coding and playing computer games - you'll have the rest of your life to do that.

    gg

  9. #9
    Registered User
    Join Date
    Jun 2004
    Posts
    722
    You're only 10??? !!!
    Well you're trying to write programs to be undetected by a computer usar, because any process can be easily detected in memory.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Terminating Zero
    By DickArmy in forum C Programming
    Replies: 9
    Last Post: 07-01-2009, 02:53 PM
  2. sequential file program
    By needhelpbad in forum C Programming
    Replies: 80
    Last Post: 06-08-2008, 02:04 PM
  3. error: missing terminating " character
    By nasim751 in forum C Programming
    Replies: 2
    Last Post: 04-17-2008, 02:50 AM
  4. terminating a while loop with a character
    By just_learning in forum C Programming
    Replies: 3
    Last Post: 04-13-2007, 06:22 AM
  5. terminating wrong process
    By Queatrix in forum Windows Programming
    Replies: 12
    Last Post: 09-09-2006, 02:16 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21