Disable Task Manager in C# on the Vista OS
Hello everyone. I'm trying to create a secure program in C#, and my hurdle is trying to prevent the user from accessing the Task Manager, to stop them from closing the program and accessing Windows. The problem I've had is all the topics online on how to do this are only texted in XP, and don't work on Vista. So I'm kind of stuck. Can anyone help me please?
jingePosted Oct 21, 2009, 11:03 PM
http://tamaspiros.co.uk/2007/12/20/c-disable-ctrl-alt-del-alt-tab-alt-f4-start-menu-and-so-on/
If it helps, please do check "Do you like the answer" please.
KennethPosted Apr 9, 2010, 4:15 PM
this is how
[DllImport("user32.dll")]
public static extern IntPtr FindWindow(string lpclass, string lpname);
public const int WM_COMMAND = 0x0112;
public const int WM_CLOSE = 0xF060;
[DllImport("user32.dll")]
public static extern int SendMessage(int hWnd, uint Msg, int wParam, int lParam);
then in the thread, replace the close window with SendMessage(hwndtskm.ToInt32(), WM_COMMAND, WM_CLOSE, 0); then it will close instead of minimizing
jingePosted Oct 22, 2009, 12:08 AM
BryanPosted Oct 21, 2009, 11:59 PM
jingePosted Oct 21, 2009, 11:56 PM
I come back. The application tests to be successful in my Vista machine. Let me know your email, I'll send you the solution.
BryanPosted Oct 21, 2009, 11:49 PM
I'm really not sure what you mean. I'm a little confused by what you're telling me to do.
@Jingi
Thank you, I'll be here.
jingePosted Oct 21, 2009, 11:44 PM
Master BillaPosted Oct 21, 2009, 11:43 PM
use my code to do this,just add this registry code with your c#
In your registry at
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\
System
set DisableTaskMgr value to 1
first you have to create a key in HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\
named: "System" with a subkey(REG_DWORD) named "DisableTaskMgr" with value set to 1
thank you
BryanPosted Oct 21, 2009, 11:41 PM
jingePosted Oct 21, 2009, 11:39 PM
BryanPosted Oct 21, 2009, 11:33 PM
jingePosted Oct 21, 2009, 11:31 PM
there's much more restrictions when are accessing them in Vista due to high security level. I suggest you run the application under administrator accounts or run as administrator.
BryanPosted Oct 21, 2009, 11:07 PM
I have seen that article many times. And unfortunately that method of disabling Ctrl Alt Del does not work in Vista. It won't let me access the registry.
BryanPosted Oct 21, 2009, 6:02 PM
BryanPosted Oct 21, 2009, 5:57 PM
Kirtan PatelPosted Oct 21, 2009, 4:02 PM
please check "do you like this answer" if helps you :)
BryanPosted Oct 21, 2009, 3:54 PM
Kirtan PatelPosted Oct 21, 2009, 3:52 PM
Here I m posting code for Make Task Manager Non Usable for User when your program is running in memory
please don't use it in any malicious purpose :) it will work on any windows Version
and check "Do you like answer" please :)
using System.Threading;
using System.Runtime.InteropServices;
namespace WindowsFormsApplication17
{
public partial class Form1 : Form
{
[DllImport("user32.dll")]
public static extern bool CloseWindow(IntPtr hwnd);
[DllImport("user32.dll")]
public static extern IntPtr FindWindow(string lpclass, string lpname);
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
Thread t1 = new Thread(CloseTaskMgr);
t1.Start();
}
public static void CloseTaskMgr()
{
for (; ; )
{
IntPtr hwndtskm = FindWindow(null, "Windows Task Manager");
CloseWindow(hwndtskm);
}
}
}
}