• Looking for a specific exe
    4 replies, posted
I want to create a launcher for a game, and I want my application to look into C:\Games (for example) for its executable (to detect it). I can do this by looking for the name, but what if the user renamed it? There must be an easier way.
You should be more specific. What do you mean by "launcher", and what does it do? Any reason you can't use a shortcut? And where will this "launcher" be located?
You could go with finding each *.exe, check the filesize and calculate the hash of its contents. But why should the user rename the file?
In addition: It's too much work trying to detect if the user renamed it, 99% of the PC world knows that if you rename something and it stops working, you should rename it back.
[QUOTE=SupahVee;19821705]I want to create a launcher for a game, and I want my application to look into C:\Games (for example) for its executable (to detect it). I can do this by looking for the name, but what if the user renamed it? There must be an easier way.[/QUOTE] If the game exe has the original filename, and you are just looking for the install dir (The user didn't install it into the default location such as "C:\Program Files\EA Games\drm-with-bonus-game.exe"), you might be able to get the install dir from the registry(windows). [QUOTE][HKEY_CURRENT_USER\Software\Blizzard Entertainment\Warcraft III] "InstallPath"="E:\\Games\\Warcraft III" "Program"="E:\\Games\\Warcraft III\\Warcraft III.exe"[/QUOTE] Then to find a renamed exe you can check hashes to find a specific exe(exact version) or you can probably just load resources to find the general exe [QUOTE]1 VERSIONINFO FILEVERSION 1,0,0,1 PRODUCTVERSION 1,0,0,1 FILEOS 0x40004 FILETYPE 0x1 { BLOCK "StringFileInfo" { BLOCK "040904b0" { VALUE "Comments", "" VALUE "CompanyName", "Blizzard Entertainment" VALUE "FileDescription", "Warcraft III" VALUE "FileVersion", "1, 0, 0, 1" VALUE "InternalName", "Warcrarft III" VALUE "LegalCopyright", "Copyright © 2002" VALUE "LegalTrademarks", "" VALUE "OriginalFilename", "Warcraft III.exe" VALUE "PrivateBuild", "" VALUE "ProductName", "Warcraft III" VALUE "ProductVersion", "1, 0, 0, 1" VALUE "SpecialBuild", "" } } BLOCK "VarFileInfo" { VALUE "Translation", 0x0409 0x04B0 } }[/QUOTE] But users really shouldn't be renaming exes of installed applications/games.
Sorry, you need to Log In to post a reply to this thread.