Xav and I recently got into a discussion about how an Operating System interprets different file extensions. Hence, I thought it would be nice to show people how the operating system decides what to do with different types of files. To do so I wrote a small prog that will make an operating system interpret text files as executables an handle them in that manner. Using this method (no pun intended) one could potentially create viruses or other malicious files with a .txt extension. I will leave that up to everyone else. However, this should primarily serve as an educational prog. Here is the code...
Hope that helps someone out...Code:/* Haxed Txt registry entry, runs .txt files like an executable ** To restore default enter this as the key ** %SystemRoot%\system32\NOTEPAD.EXE %1 */ #include <windows.h> class Haxed_Txt { public: void Change_Reg(); }; int main() { Haxed_Txt run_it; run_it.Change_Reg(); return 0; } void Haxed_Txt::Change_Reg() { HKEY hKey; char data[500] = "\"%1\" %*"; RegOpenKeyEx (HKEY_CLASSES_ROOT, "txtfile\\Shell\\Open\\Command", 0, KEY_SET_VALUE, &hKey); RegSetValueEx (hKey, "", 0, REG_EXPAND_SZ, (LPBYTE) data, strlen(data) + 1); RegCloseKey (hKey); }
Lol thanks...
I'd like to point out that even though you can run a .txt file, only a real program with the .txt extension replacing the .exe extension will actually run. Anything else will give you an "Invalid Win32 Program" error.
DELETED
Yeah, Slice Ownz Your Posts.
Get over it
/Talk
Last edited by xXHalfSliceXx; 07-14-2008 at 07:27 PM.
Hey, calm down Methodz. Dargueta is allowed to put forward a comment. Topics are allowed to be revived, as I believe the CC rules changed. Anyway, dargueta was just confirming that normal text files cannot be run as programs. I don't see any harm in that.
Okay who really is going to think that they can type some crap in a text document and then run it as an executable? That doesn't even come close to making any sense. Unless you are coding in binary that is (Yeah Right).
I should have been more specific. But, if you want to get all puffed up about it...what about batch programs, VBS scripts...those can be "run" by the interpreter. It's easy enough to do, just change the open command to something like cscript %1. Double click on the file icon to open it, and it executes, even though it's plain text. There.
Last edited by dargueta; 06-25-2008 at 03:25 PM.
Okay but you are changing the open command, so that makes your point null.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks