Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 552501
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T11:30:23+00:00 2026-05-13T11:30:23+00:00

I am writing a C# application that, among other things, automatically closes the advertisement

  • 0

I am writing a C# application that, among other things, automatically closes the advertisement a certain game displays after the user exits the game. My program accomplishes this by killing the game process when it detects that the user has exited the game. My program is similar to an Autohotkey script written by someone else that does similar things but it adds some features and a GUI.

Naturally, I used the Process.Kill method. However, that would fail with an “Access is denied” exception. I noticed that the Autohotkey script uses an unusual method of killing the process. I asked the author about it, and he said that he too had trouble killing the process with normal methods.

We suspect the reason normal process termination methods do not work is the HackShield software the game uses to attempt to combat cheating.

Here is the Autohotkey code the other guy’s script uses for killing a process:

; kills all process instances of a given executable name
; COM AutoHotkey library code omitted
KillProcessInstances(exe)
{
  psvc := COM_GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2")
  pset := COM_Invoke(psvc, "ExecQuery", "Select * from Win32_Process Where Name = '" exe "'")
  penm := COM_Invoke(pset, "_NewEnum")
  Loop, % COM_Invoke(pset, "Count")
    If COM_Enumerate(penm, pobj)=0
    {
      COM_Invoke(pobj, "Terminate")
      COM_Release(pobj)
    }
  COM_Release(penm)
  COM_Release(pset)
  COM_Release(psvc)
}

I replaced the Process.KIll with the WMI calls in my program using the System.Management namespace and my program is now able to kill the process.

What I don’t understand is what makes the WMI any different from Process.Kill. I would expect both to work or both to fail. In addition, Task Manager is able to kill the process just fine, but I would think it just uses a TerminateProcess win32 call just as Process.Kill surely does. Can anyone shed some light on the cause of the different behavior? If it matters, I’m running Windows XP.

Edit: wj32 explained why the WMI works, but can anyone explain why I can kill the process with Task Manager but not with my own program?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T11:30:24+00:00Added an answer on May 13, 2026 at 11:30 am

    WMI calls are not performed within the security context of your process. They are handled in another process (I’m guessing the Winmgmt service). This service runs under the SYSTEM account, and HackShield may be allowing the termination continue due to this.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm working on an application which among other things downloads items that belong to
I have an application that will, among other things, store various data into a
I am writing an application that allows a user to place images on a
I'm writing an application that gives the user the option to resize an image
I'm currently writing an application that displays a lot , and I mean, a
I'm writing an application that will create difficult passwords for the user. The user
I'm writing an application that interacts with other processes on a x64 Vista machine.
I'm writing a fairly complex ListView , which (among other things) requires formatting Views
I am writing a visualforce page that amoung other things allows creation of Queues.
I am writing a Facebook application that would use a Postgres DB along with

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.