Jump to content
  • Advertisement
Sign in to follow this  
PhlashStudios

Deleting individual pieces of programs

This topic is 4673 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

Hi everyone, I was just wondering, is there any way in C++ or any other language for that matter, to delete individual bits and bites of a program on someones hard drive (don't worry this isnt for anything nefarious) so like take a program and delete a few ones and zeros from it? Or even whole chunks?

Share this post


Link to post
Share on other sites
Advertisement
Yes, it is possible but it would be hard to tell what your deleting! Just open up the file and start deleting. NOTE: Research the file format firze, if its something like an MZ EXE then I believe the first 512 bytes are header info. And in that info is the size of the program and the pages and such so if you modify the program, you also have to modify the header. Its a pain but can be done

Hope that helps

Share this post


Link to post
Share on other sites
You can edit an executable remove some stuff, whatever, but it probably won't run when you're done with it if you don't do it right.

Share this post


Link to post
Share on other sites
Quote:
Original post by PhlashStudios
Could you give me some sort of an example?
What exactly are you trying to do? Is there any non nefarious use for this?

Share this post


Link to post
Share on other sites
Well what I was thinking is you have a watchdog program, that whenever a program is installed on your machine you set a time period for it to be deleted, or you make it invincible, and if you dont select anything it has a period of an hour before it is deleted. So every day the watchdog removes part of the program from your computer in a way that still allows it to run but compromises some features. This would essentially eliminate clutter and viruses that dont immediately wipe your hard drive.

Share this post


Link to post
Share on other sites
Quote:
Original post by PhlashStudios
Well what I was thinking is you have a watchdog program, that whenever a program is installed on your machine you set a time period for it to be deleted, or you make it invincible, and if you dont select anything it has a period of an hour before it is deleted. So every day the watchdog removes part of the program from your computer in a way that still allows it to run but compromises some features. This would essentially eliminate clutter and viruses that dont immediately wipe your hard drive.
A specific program, or any program? Why would you muck around removing features from a random .exe? All your going to do is mess up the files. Wouldn't it be easier to modify another external file, and just not offer the features at runtime (in your own .exe)

Share this post


Link to post
Share on other sites
Quote:
Original post by PhlashStudios
Any program that is downloaded to the computer and that the user states to be not invincible
That makes no sense... [wow] You'd never know which part of the .exe was for what.. let alone that's it's illegal to modifdy most .exe files in their EULA. Why would anyone even want something like this? They can delete their own unwanted programs via a proper unistall.

Who wants their programs to rot away over time, and mess up their uninstall data?

Share this post


Link to post
Share on other sites
One thing you can do is figure out what the actual hex instructions are for your processor. For example, after a few minutes of mucking around with DEBUG, I was able to determine the following:

* B8yyxx = mov ax, xxyy
* CDxx = int xx
* C3 = ret

So, to put together a small routine that places the computer into mode 13h (an old video mode from the DOS days, for those who didn't know) would look something like this:


B81300CD10C3


That's 16-bit code, however. If you want to get into 32-bit code, I suggest downloading NASM and using it's NDISASM program to disassmble simple programs to find out what the machine-language equivalents actually are.

If you can figure out enough of the codes, parse an executable's header section, and identify the sections of the code that you want to modify, then you can write self-modifying code, or the watchdog program the OP described.

edit: Of course, you're going to have to learn some assembly language to do all this, but assembly is fun! (at least, that's how I find it, you might not)

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!