CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5

Thread: There is possible to safety kill a process by word?

  1. #1
    Join Date
    Sep 2014
    Posts
    7

    There is possible to safety kill a process by word?

    Every one knows that when you work on Windows and you make a persistent process with C++ it will hurt your machine if you kill him on task manager. Creating temp trash and maybe it corrupts the memory or the disk in long term (tested and approved by me.)

    Ok... a persistant process is part of the game, but i must close it in safe mode.
    I could wait for a pressed key but that is not an option.
    I would like to use a secret word, so here is is my question.

    There is posible to read from the keyborad a fast concatenation or a complete message like "secretwordwichstopprocess"

    I think, validate char by char could be a little unperforming.

    I Usually use GetAsyncState but somebody told me something about PreTranslateMessage could be better.

    ... is this posible?

  2. #2
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,280

    Re: There is possible to safety kill a process by word?

    Please explain:

    >> Every one knows that when you work on Windows and you make a persistent process with C++ it will hurt your machine if you kill him on task manager.

    What is a 'persistent process?' How will killing a process 'hurt your machine?'

  3. #3
    2kaud's Avatar
    2kaud is online now Super Moderator Power Poster
    Join Date
    Dec 2012
    Location
    England
    Posts
    7,118

    Re: There is possible to safety kill a process by word?

    Re processes. There are basically/simply 2 types:

    1) User process. These are either started automatically when a user logs on directly by the user
    2) System service. These are started automatically by the OS when the system is started. Their state can be stopped/started etc.

    For each of these types, they can be either user-produced from available source code (which can be amended and compiled) or part of the OS or part of an installed 'application'.

    What type of 'process' are we talking about here?
    Last edited by 2kaud; April 28th, 2020 at 03:34 AM.
    All advice is offered in good faith only. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/ and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!

    C++17 Compiler: Microsoft VS2019 (16.6.1)

  4. #4
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,280

    Re: There is possible to safety kill a process by word?

    2kaud, Windows has only one type of process regardless of whether it's invoked by a user, user code, or the service control manager. Windows services expose additional functionality that the SCM hooks into but when they are started they are created and run like any other process.

  5. #5
    2kaud's Avatar
    2kaud is online now Super Moderator Power Poster
    Join Date
    Dec 2012
    Location
    England
    Posts
    7,118

    Re: There is possible to safety kill a process by word?

    Quote Originally Posted by Arjay View Post
    2kaud, Windows has only one type of process regardless of whether it's invoked by a user, user code, or the service control manager. Windows services expose additional functionality that the SCM hooks into but when they are started they are created and run like any other process.
    Yes - perhaps I was being too simplistic in my post #3 in the context of the question asked.
    All advice is offered in good faith only. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/ and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!

    C++17 Compiler: Microsoft VS2019 (16.6.1)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width




On-Demand Webinars (sponsored)