Deleting individual pieces of programs

Started by
10 comments, last by stylin 18 years, 2 months ago
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?
<a href="http://eyeredux.com/campaigns/1/redirect">Hello!</a>
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
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.
Could you give me some sort of an example?
<a href="http://eyeredux.com/campaigns/1/redirect">Hello!</a>
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?

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 href="http://eyeredux.com/campaigns/1/redirect">Hello!</a>
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)
Any program that is downloaded to the computer and that the user states to be not invincible
<a href="http://eyeredux.com/campaigns/1/redirect">Hello!</a>
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?

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)

This topic is closed to new replies.

Advertisement