Hi, I've seem some programs run without having the .exe extension. How is that possible?
Hi, I've seem some programs run without having the .exe extension. How is that possible?
under linux and unix, the program files don't have extensions. they use an executable bit in the filesystem instead.
they have the .exe extension, it is just hidden in Explorer, as is many other extensions. if you're seeing a file that looks like this in Explorer:
file.exe
its real name is likely:
file.exe.exe
a good way to demonstrate this is to take one of those files that you are seeing the .exe in and upload it on the internet. once you select the file in the file open dialog you'll see its true file name, which will be file.exe.exe.
if you want to be able to see the extensions for known file types, go to the Control Panel and click:
Tools > Folder Options > View
and uncheck the "Hide extensions for known file types" checkbox.
Last edited by Bleech; 08-22-2007 at 10:35 PM. Reason: better advice.
Intel Core 2 Quad Q6600 @ 2.40 GHz
3072 MB PC2-5300 DDR2
2 x 320 GB SATA (640 GB)
NVIDIA GeForce 8400GS 256 MB PCI-E
you mean COM?
Why not?
Make a copy of calc.exe to your folder and rename it to calc.txt. Then make a program and do this in it:
You can easily create a process with from a file with any extension.Code:STARTUPINFO si; PROCESS_INFORMATION pi; ZeroMemory(&si,sizeof(STARTUPINFO)); CreateProcess("calc.txt",0,0,0,false,0,0,0,&si,&pi);
BUT, you can't execute other extensions as programs just by clicking on them or writing them on the command prompt, because then the ShellExecute is called and that opens the file with the program it is associated to (and if not associated, then will prompt "Open with").
Last edited by maxorator; 08-23-2007 at 02:25 PM.
"The Internet treats censorship as damage and routes around it." - John Gilmore
that works because CreateProcess/Ex does not pay any attention to the extension, it simply tries to execute the file irregardless.
if you're asking how to register a custom extension for executable files, then I think you should take a look at the HKEY_CLASSES_ROOT key in the registry. find the .exe key, create a new key for your new extension (e.g.: .xxx), and copy the values (specifically "Content Type") from the .exe key into your new key.
RegOpenKeyEx
RegQueryValueEx
RegCreateKeyEx
RegSetValueEx
RegCloseKey
Last edited by Bleech; 08-23-2007 at 05:58 PM.
Intel Core 2 Quad Q6600 @ 2.40 GHz
3072 MB PC2-5300 DDR2
2 x 320 GB SATA (640 GB)
NVIDIA GeForce 8400GS 256 MB PCI-E
Alright nice, thanks