GIDForums  

Go Back   GIDForums > Computer Programming Forums > C++ Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 03-Jan-2009, 19:41
marshmello822 marshmello822 is offline
New Member
 
Join Date: Jan 2009
Posts: 1
marshmello822 is on a distinguished road
Question

System("taskkill"); alternative?


I'm working on a project to kill an application if it is running with a certain dll and if the time conditions permit. For example if someone opens a program with test.dll and the program is engaged I want to terminate it and if its not I want it to wait it out until the time is engaged and kill it. I am currently using the system(""); command with Taskkill /F /FI "MODULES eq test.dll" /FI "IMAGENAME ne calc.exe" however I am running into problems with double quotes and closing of the application, and it introduces an insecurity with the program (someone deletes taskkkill...) Is there a alternative? I would prefer to not use any system commands at all. The last thing I haven't a clue on how to include is to add new not equals exceptions without a recompile and without people being able to read the external file. the /FI "IMAGENAME ne calc.exe" makes it so that it wont kill calc.exe if it has test.dll. I need to be able to add new not equals exceptions without recompiling and so that people can't pry and find out they just need to rename exe's to run stuff. Here is a snippet of the code.. not sure it helps.


CPP / C++ / C Code:
 int main()
{
 while(1)
   {
                  char buffer [80];
  int compare;
    	  time_t rawtime;
	  struct tm * timeinfo;
	  time ( &rawtime );
	  timeinfo = localtime ( &rawtime );
	  strftime (buffer,80,"%H%M",timeinfo);
	  compare = atoi(buffer);
	  std::cout << compare << std::endl;
	  if ((compare >= 915) && (compare <= 1530))
	  {
		  if ((compare >= 1220) && (compare <= 1305)) 
		  {
				std::cout << "block disengage" << std::endl; 
		  }else{
			    std::cout << "block engaged" << std::endl;
				system("taskkill.exe /F /FI \"MODULES eq test.dll\" /FI \"IMAGENAME ne calc.exe"");
				Sleep(60000);
		  }
	}else{
			 std::cout << "block disengaged" << std::endl;
			 Sleep(5000);
			  }
		}

}


The main thing Im looking to do is get rid of external calls with system the external exception adding is just a plus. I know im asking alot but thanks in advance
  #2  
Old 05-Jan-2009, 03:12
Peter_APIIT Peter_APIIT is offline
Regular Member
 
Join Date: May 2007
Location: Malaysia
Posts: 545
Peter_APIIT can only hope to improve

Re: System("taskkill"); alternative?


Impossible to get rid from system call to accomplish your task.
 
 

Recent GIDBlogInstall Adobe Flash - Without Administrator Rights by LocalTech

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Alternative CC Processor iedefender eCommerce / Merchant Account Forum 5 13-Mar-2009 19:05
Is there any alternative function on select() [socket api] ? tonmoy_C C Programming Language 10 13-May-2008 10:57
PayPerClick-PayPerPlay.com Alternative to PPC OWNtheINTERNET Advertising & Affiliates Forum 0 05-Feb-2008 12:47
Re: Alternative PHP Cache (APC) admin Web Hosting Forum 0 04-May-2006 23:41

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 20:28.


vBulletin, Copyright © 2000 - 2010, Jelsoft Enterprises Ltd.