Needing to know if...

Needing to know if...

Page 1 of 1

10 Replies - 1431 Views - Last Post: 29 February 2008 - 01:52 PM Rate Topic: -----

#1 ajax-maxx  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 9
  • Joined: 17-December 07

Needing to know if...

Post icon  Posted 27 February 2008 - 01:18 PM

Just needing to know if there is a way of blocking selective programs from running from inside a C# program...

:crazy:

This post has been edited by ajax-maxx: 27 February 2008 - 01:18 PM

Is This A Good Question/Topic? 0
  • +

Replies To: Needing to know if...

#2 PsychoCoder  Icon User is offline

  • Google.Sucks.Init(true);
  • member icon

Reputation: 1642
  • View blog
  • Posts: 19,853
  • Joined: 26-July 07

Re: Needing to know if...

Posted 27 February 2008 - 01:25 PM

I'm not sure I'm completely understanding your question here. Can you be a little more specific please :)
Was This Post Helpful? 0
  • +
  • -

#3 ajax-maxx  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 9
  • Joined: 17-December 07

Re: Needing to know if...

Posted 27 February 2008 - 01:41 PM

View PostPsychoCoder, on 27 Feb, 2008 - 01:25 PM, said:

I'm not sure I'm completely understanding your question here. Can you be a little more specific please :)



Yes I am writing a service app that runs in the background That prevents Users from accessing The fallowing CMD, Control Panel, Installations", Internet, and Task-Manager from inside my app w/o setting User Admin Rights...

How do I do this???

The code I am looking for will be activated by a check-box for each item...

Sorry about the confusion :blink:

This post has been edited by ajax-maxx: 27 February 2008 - 03:50 PM

Was This Post Helpful? 0
  • +
  • -

#4 ajax-maxx  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 9
  • Joined: 17-December 07

Re: Needing to know if...

Posted 27 February 2008 - 02:21 PM

Is there a way to do this???

It would be ober helpful
Was This Post Helpful? 0
  • +
  • -

#5 ajax-maxx  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 9
  • Joined: 17-December 07

Re: Needing to know if...

Posted 28 February 2008 - 10:18 AM

Ok I found two ways of doing this One was to place a registry edit that hooked and unhooked the Processes I wanted to disable... (alot of code)

Then I found this page by PsychoCoder that had this code...
//Namespaces needed
using System.Diagnostics;

public bool FindAndKillProcess(string name)
{
	//here we're going to get a list of all running processes on
	//the computer
	foreach (Process clsProcess in Process.GetProcesses) {
		//now we're going to see if any of the running processes
		//match the currently running processes by using the StartsWith Method,
		//this prevents us from incluing the .EXE for the process we're looking for.
		//. Be sure to not
		//add the .exe to the name you provide, i.e: NOTEPAD,
		//not NOTEPAD.EXE or false is always returned even if
		//notepad is running
		if (clsProcess.ProcessName.StartsWith(name))
		{
			//since we found the proccess we now need to use the
			//Kill Method to kill the process. Remember, if you have
			//the process running more than once, say IE open 4
			//times the loop thr way it is now will close all 4,
			//if you want it to just close the first one it finds
			//then add a return; after the Kill
			clsProcess.Kill();
			//process killed, return true
			return true;
		}
	}
	//process not found, return false
	return false;
}


And am wondering if this could be made into a Constant Loop to kill the process everytime its started???

This post has been edited by ajax-maxx: 28 February 2008 - 10:35 AM

Was This Post Helpful? 0
  • +
  • -

#6 zakary  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 27
  • View blog
  • Posts: 427
  • Joined: 15-February 05

Re: Needing to know if...

Posted 29 February 2008 - 05:54 AM

Why do you want to block

Quote

CMD, Control Panel, Installations", Internet, and Task-Manager from inside my app w/o setting User Admin Rights...
everyday users should have accesses to them unless you are writing a virus that is the only reason I can see for not allowing access to

Quote

CMD, Control Panel, Installations", Internet, and Task-Manager

Was This Post Helpful? 0
  • +
  • -

#7 ajax-maxx  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 9
  • Joined: 17-December 07

Re: Needing to know if...

Posted 29 February 2008 - 11:06 AM

View Postzakary, on 29 Feb, 2008 - 05:54 AM, said:

Why do you want to block

Quote

CMD, Control Panel, Installations", Internet, and Task-Manager from inside my app w/o setting User Admin Rights...
everyday users should have accesses to them unless you are writing a virus that is the only reason I can see for not allowing access to

Quote

CMD, Control Panel, Installations", Internet, and Task-Manager



Yeah I write viruses for a hobby :P LOL

I am creating a program that allows you (The Admin) to control a computer that has multiple Admin accounts, and multiple users... (One thing I hate about using Limited user accounts is that in order for me to do anything in them I either A. have to log off and do it from my account or B. I have to consistantly put my username and password into a the run as box to preform the tasks that need to be done)...

This program allows me to preform all tasks just by a small shortcut...

This program once set; limits the time that any one person can be logged in, and sets the accounts according to what I will allow. There is a kill key for this program so I can run installs of new programs or other admin tasks for them that key is (alt+ctr+F12) then reset it using (alt+ctr+F11) so they can then play there games...

Here is a Screen shot of the program: Posted Image

LOL a Managed C# .Net Virus hahaha :rolleyes:

Whats up with the forum calling every body a DIC Head???

This post has been edited by ajax-maxx: 29 February 2008 - 11:39 AM

Was This Post Helpful? 0
  • +
  • -

#8 PsychoCoder  Icon User is offline

  • Google.Sucks.Init(true);
  • member icon

Reputation: 1642
  • View blog
  • Posts: 19,853
  • Joined: 26-July 07

Re: Needing to know if...

Posted 29 February 2008 - 11:10 AM

@ajax-maxx: You could put that code inside a timer event that runs in its own thread and set the timers interval to the interval you wish to have it check the list of processes.
Was This Post Helpful? 0
  • +
  • -

#9 ajax-maxx  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 9
  • Joined: 17-December 07

Re: Needing to know if...

Posted 29 February 2008 - 11:17 AM

View PostPsychoCoder, on 29 Feb, 2008 - 11:10 AM, said:

@ajax-maxx: You could put that code inside a timer event that runs in its own thread and set the timers interval to the interval you wish to have it check the list of processes.



Thanks I'll give it a try... B)
Was This Post Helpful? 0
  • +
  • -

#10 ajax-maxx  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 9
  • Joined: 17-December 07

Re: Needing to know if...

Posted 29 February 2008 - 01:42 PM

View Postajax-maxx, on 29 Feb, 2008 - 11:17 AM, said:

View PostPsychoCoder, on 29 Feb, 2008 - 11:10 AM, said:

@ajax-maxx: You could put that code inside a timer event that runs in its own thread and set the timers interval to the interval you wish to have it check the list of processes.



Thanks I'll give it a try... B)


Ok Here is the code written so far tell me what I did wrong LOL...

		 private void checkBox1_Checked(object sender, EventArgs e)
		{
			if (checkBox1.Checked) timer1.Enabled = true;   
		}
		
		private void timer1_Tick(object sender, EventArgs e)
		}
	// Name of Process to Kill
			public bool FindAndKillProcess(string taskmgr)
	{
	// Get Processes
	foreach (Process clsProcess in Process.GetProcesses) 
	{
	// Check for process Name
		if (clsProcess.ProcessName.StartsWith(taskmgr))
		{
	// Kill Named
			clsProcess.Kill();
			//process killed, return true
			return true;
		}
	}
	// process not found, return false
	return false;
	}
} 


bool shows up as Red tagged and it says I am Missing a ; after private void timer1_Tick(object sender, EventArgs e)

be gentile I am a n00b!3
Was This Post Helpful? 0
  • +
  • -

#11 PsychoCoder  Icon User is offline

  • Google.Sucks.Init(true);
  • member icon

Reputation: 1642
  • View blog
  • Posts: 19,853
  • Joined: 26-July 07

Re: Needing to know if...

Posted 29 February 2008 - 01:52 PM

Your're missing your semi-colon after this line

// Name of Process to Kill
public bool FindAndKillProcess(string taskmgr)



Change it to


// Name of Process to Kill
public bool FindAndKillProcess(string taskmgr);



and that error should go away

This post has been edited by PsychoCoder: 29 February 2008 - 01:53 PM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1