Jump to content
  • Advertisement
Sign in to follow this  
ShitFire

need help with c++ !!!

This topic is 4927 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

so i got a question for c++ ! 1. i want my program to check if there is a running process named "blabla.exe" or something like that. 2. i want to, if he finds this process, shut down the programm. 3. how can i delete programms ? i mean like in visual basic it was: kill c:/programs/hi/lol.txt what is this in c++ ??? 4. How can i check for a data on the computer ? like c:/programs/hi/lol.txt how can i look for this data on c++ ? thanks

Share this post


Link to post
Share on other sites
Advertisement
The only way I know how to do it in C++ is with the system() function.

It lets you give commands at a fake dos prompt, like system("delete file.exe");
It's bad to use it for somereason though.
Just include <cstdlib> to use it.

Share this post


Link to post
Share on other sites
Not to be offensive, but I have to admit, I am rather suspicious of your motives. You wish to shut things down, delete files, and find data, have a name like ShitFire, and seem to have not put forth much effort searching for the answers elsewhere before asking people who have to spend time to respond. So first of all, please expand on the purpose for which you want to know these things, because they could be used in a malicious way, and I'd prefer not to help someone with malicious activities. I am truly sorry if I've got it all wrong, but I'd rather be on the cautious side, so hopefully you'll understand.

Share this post


Link to post
Share on other sites
well i think i have to reply to the last post !

i do NOT have the pupose of making any virus!!!

i will tell u why i need this: So I was making a text based RPG for c++ with my friend but then i noticed that this project is going to take far to long for that what it is worth.
i decided to make a different project: ANTI virus !!!

yes i want to see if i can do this. yesterday i came on to this idea because i have some adware called: IBIS TOOLBAR. well i cant get rid of it... i had to get tons of Antivir programs. i am even surfing with mozilla...

i thought how cool Kaspersky was so i wanted to make my own ^^

thatswhy i need this: detect running process: (Wsup.exe)
stop process.
delete data of virus. (if i know what the data is :P )

please dont missunderstand me :(


EDIT: i tried this:

i opened an Opengl program named : LadyOfDarkAutumn.exe
then i went on: system("delete LadyOfDarkAutumn.exe");

but he didnt delete it :/ hmm...
thansk for helping ;)

thx

Share this post


Link to post
Share on other sites
Sounds like spyware, and not a virus, to me. BTW, it's easier to program a text RPG than it is to program Antivirus software.

It's a little more than just shutting down processes and deleting files. I say re-format your computer, and stick with your original RPG plans :)

Share this post


Link to post
Share on other sites
well no i dont want to stick with text rpgs ;)

i know that i cant delete the virus i am scanning (i dont mean my spyware!!!) but atleast i can detect it!

i searcht a while and i came but with:

#include "windows.h"
DeleteFile("LadyOfDarkAutumn.exe");

i put it in a dos program but it doesnt work :(

please can some1 help me and tell me how i can detect and shut down processes ?

at least u could tell me how to detect. that would be a start.

thanks ;)

Share this post


Link to post
Share on other sites
anything you write inside system() function is same as writing it in a dos/console prompt.
for deleting files you can use remove("c:/programs/hi/lol.txt");
it is an ANSI-C function to erase files.
I was thinking you're doing a small app to remove some spyware you cant delete.
In Windows, instead of writing your own files finder algorithm- you can use a ready one.
If you're programming in .NET, you probably like to look at the Process Class.
I see you're intersted in Security, then you may be intersted in this link.

By the way, deleting doesn't mean shutting down.
what you tried to do, is to delete LadyOfDarkAutumn.exe from the current directory, which doesn't exist or cannot be removed while running?
you want to close LadyOfDarkAutumn.exe, right? (i dont know how to do this instead of using the Process Class.)

pex.

Share this post


Link to post
Share on other sites
well LadyOfAutumn was just a test. it was a nice OpenGL program.
i wanted to delete the file of C: . And i gave showed him the directory to!.

Share this post


Link to post
Share on other sites
you cant run 'x' and delete 'x' while 'x' is still running.
same why you cant write/edit 'x' while it is running.
you can do that each time windows is start- you'll delete 'x'.
just add 'delete x' in c:\auto.bat (i think this is the file in win98, but i dont think it is exist in xp. well, you can always make a small program which deletes x and tell windows to run this file before any other program (exept windows of course).
it is somewhere inside the Registry. i found it in past, just a second.

pex.

Share this post


Link to post
Share on other sites
Well i tried this code:

#include "stdio.h"

void main()
{
cout<<"Geben sie was ein"<<endl;
cin>> a;
if(a==b)
{
remove("c:/hiho.txt");
}
}

but it doesnt delete the .txt file :(

what should i do ?

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!