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); }


LinkBack URL
About LinkBacks




Reply With Quote






Bookmarks
Algorithms and Data Structures
Java tutorials
Algorithms Forum