.exe detect/stop

This is a discussion on .exe detect/stop within the Windows Programming forums, part of the Platform Specific Boards category; I am making a program. How would I detect that a .exe file tries to run while the program is ...

  1. #1
    Programming is fun, mkay?
    Join Date
    Oct 2001
    Posts
    490

    Question .exe detect/stop

    I am making a program. How would I detect that a .exe file tries to run while the program is open and keep it from opening?
    Website(s): http://www16.brinkster.com/trifaze/

    E-mail: trifaze_mattu@lycos.com

    ---------------------------------
    C++ Environment: MSVC++ 6.0; Dev-C++ 4.0/4.1
    DirectX Version: 9.0b
    DX SDK: DirectX 8.1 SDK

  2. #2
    Former Member
    Join Date
    Oct 2001
    Posts
    955
    Well, this is just an idea: at the beggining of the program, check what HINSTANCE's are currently active, and every once in a while, check them again, and if there is a new HINSTANCE, close it with CloseHandle() or something like that


    Oskilian

  3. #3
    Programming is fun, mkay?
    Join Date
    Oct 2001
    Posts
    490

    Question Question about that

    Well, how do I check for a new HINSTANCE?
    Website(s): http://www16.brinkster.com/trifaze/

    E-mail: trifaze_mattu@lycos.com

    ---------------------------------
    C++ Environment: MSVC++ 6.0; Dev-C++ 4.0/4.1
    DirectX Version: 9.0b
    DX SDK: DirectX 8.1 SDK

  4. #4
    )DarkStar(
    Guest
    Another question is, how would you be able to distinguish between instance handles active in the OS. It would seem perilous to indiscriminately close detected instances. It's possible to start a new thread in the OS with CreateProcess(), but i don't think you will be able to "take it back".

  5. #5
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,856
    A good question is why?

    Do you want to detect other instances of your app? If so do a search for the code, I have posted it before.

    Or do you want to stop the virus checker ect?

  6. #6
    Programming is fun, mkay?
    Join Date
    Oct 2001
    Posts
    490

    Post I want to..

    I was wanting to make my own program that will detect a specified file has tried to run, stop the execution, and ask for a password. Just a password protection program.

  7. #7
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,856
    I have posted code for FileMapping before.
    Look up the previous post to find it.
    Get your progam to run the exe you are interested in and file map it. If 'someone' else in your PC runs it it you will be able to detect it and respond.

  8. #8
    )DarkStar(
    Guest
    As usual I have been proven wrong, not only is it possible to terminate a process in the OS, there is a zip file with an .exe file that demonstrates it, and the source code is available with it also. Be fore warned though, it is coded in Win32 80x86 assembley. But with patience and care the source code could be abstracted to C/C++.

    Go to the following link...
    http://win32asm.rxsp.com/source1.html

    Navigate to where it says "KillProc" by "Comrade", and click on it to download the zip file.

    READ THE README FILE !!!! killproc.exe can potentially crash your system, though I myself have not experienced this yet while testing it.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. fopen can't open .exe?
    By fanoliv in forum C Programming
    Replies: 11
    Last Post: 04-05-2011, 03:24 PM
  2. Replies: 13
    Last Post: 12-09-2008, 10:09 AM
  3. .exe size with MinGW
    By Stabbsy in forum C++ Programming
    Replies: 3
    Last Post: 11-16-2006, 05:07 AM
  4. Changing program from .cpp to .exe
    By BIt_toRreNt in forum C++ Programming
    Replies: 6
    Last Post: 02-16-2005, 03:24 PM
  5. Problem creating .exe files
    By Unregistered in forum C Programming
    Replies: 1
    Last Post: 03-22-2002, 01:25 PM

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