Thread: Executable entension

  1. #1
    Registered User
    Join Date
    Mar 2007
    Posts
    38

    Executable entension

    Hi, I've seem some programs run without having the .exe extension. How is that possible?

  2. #2
    Registered User
    Join Date
    Oct 2001
    Posts
    2,129
    under linux and unix, the program files don't have extensions. they use an executable bit in the filesystem instead.

  3. #3
    Madly in anger with you
    Join Date
    Nov 2005
    Posts
    211
    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

  4. #4
    Registered User
    Join Date
    Mar 2007
    Posts
    38
    Quote Originally Posted by sl34k View Post
    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.
    Thats not what I meant. I have Process Explorer, when I open it I see all programs running with the .exe extension. But, I've seem some programs running with a different extension. For example: test.xxx The xxx is not exe So I'm wondering how to do that

  5. #5
    Registered User
    Join Date
    Oct 2001
    Posts
    2,129
    you mean COM?

  6. #6
    Reverse Engineer maxorator's Avatar
    Join Date
    Aug 2005
    Location
    Estonia
    Posts
    2,318
    Quote Originally Posted by NoFearXD View Post
    Thats not what I meant. I have Process Explorer, when I open it I see all programs running with the .exe extension. But, I've seem some programs running with a different extension. For example: test.xxx The xxx is not exe So I'm wondering how to do that
    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:
    Code:
    STARTUPINFO si;
    PROCESS_INFORMATION pi;
    ZeroMemory(&si,sizeof(STARTUPINFO));
    CreateProcess("calc.txt",0,0,0,false,0,0,0,&si,&pi);
    You can easily create a process with from a file with any extension.

    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

  7. #7
    Madly in anger with you
    Join Date
    Nov 2005
    Posts
    211
    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

  8. #8
    Registered User
    Join Date
    Mar 2007
    Posts
    38
    Alright nice, thanks

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 3
    Last Post: 04-10-2009, 12:57 AM
  2. Loading a DLL that is not in the same directory as the executable
    By starcatcher in forum Windows Programming
    Replies: 10
    Last Post: 12-13-2008, 07:05 AM
  3. CreateProcess with Resource of executable, not the Filename
    By Ktulu in forum Windows Programming
    Replies: 4
    Last Post: 11-04-2006, 01:07 AM
  4. calling an executable from an executable
    By dee in forum C Programming
    Replies: 4
    Last Post: 01-10-2004, 01:32 PM
  5. Altering The Program's Executable?
    By Aidman in forum C++ Programming
    Replies: 7
    Last Post: 12-31-2002, 05:11 AM