separate exe by types when searching

General discussion related to "Everything".
Post Reply
loma69
Posts: 1
Joined: Thu Dec 05, 2024 4:40 pm

separate exe by types when searching

Post by loma69 »

Is there is a way (when you search) to separate EXE apps like "cmd.exe" from EXE installers like "officesetup.exe"
therube
Posts: 5056
Joined: Thu Sep 03, 2009 6:48 pm

Re: separate exe by types when searching

Post by therube »

How is one to know that cmd.exe is a stand alone program & not the actual installer for the "cmd & conquer" game?

How is one to know that officesetup.exe is the installer that installs office & not a stand alone program that displays a picture of my office setup?


You could use a unix-like 'file' command, & something like that could be used to do something like:

E:\Windows\System32>file cmd.exe
cmd.exe; PE32 executable for MS Windows (console) Intel 80386 32-bit

or

C:\out>file seamonkey.exe
seamonkey.exe; PE32 executable for MS Windows (GUI) Intel 80386 32-bit

The former is a stand-alone .exe.
The latter is the seamonkey program installer - though you would not know it based upon its' name.

Or, Sigcheck.

Code: Select all

c:\out\seamonkey.exe:
        Verified:       Unsigned
        Link date:      05:18 PM 08/30/2018
        Publisher:      n/a
        Company:        SeaMonkey e.V.
        Description:    SeaMonkey
        Product:        SeaMonkey
        Prod version:   18.05
        File version:   18.05
        MachineType:    32-bit

Code: Select all

C:\>SIGCHECK E:/windows/system32/cmd*.EXE

e:\windows\system32\cmd.exe:
        Verified:       Signed
        Signing date:   04:31 AM 04/25/2016
        Publisher:      Microsoft Windows
        Company:        Microsoft Corporation
        Description:    Windows Command Processor
        Product:        Microsoft« Windows« Operating System
        Prod version:   6.1.7601.23403
        File version:   6.1.7601.23403 (win7sp1_ldr.160325-0600)
        MachineType:    64-bit
e:\windows\system32\cmdkey.exe:
        Verified:       Signed
        Signing date:   10:17 PM 07/13/2009
        Publisher:      Microsoft Windows
        Company:        Microsoft Corporation
        Description:    Credential Manager Command Line Utility
        Product:        Microsoft« Windows« Operating System
        Prod version:   6.1.7600.16385
        File version:   6.1.7600.16385 (win7_rtm.090713-1255)
        MachineType:    64-bit
e:\windows\system32\cmdl32.exe:
        Verified:       Signed
        Signing date:   04:34 AM 04/25/2016
        Publisher:      Microsoft Windows
        Company:        Microsoft Corporation
        Description:    Microsoft Connection Manager Auto-Download
        Product:        Microsoft(R) Connection Manager
        Prod version:   7.02.7601.23403
        File version:   7.02.7601.23403 (win7sp1_ldr.160325-0600)
        MachineType:    64-bit
With Everything 1.5 alpha, you may be able to... not sure what particularly, but parse or obtain certain information or Properties of said files & then output that data in some formatted fashion.


(No need for duplicate posts. Zapping the other.)
void
Developer
Posts: 17152
Joined: Fri Oct 16, 2009 11:31 pm

Re: separate exe by types when searching

Post by void »

I will consider adding an exe type property.



For now, please try the target-machine property.
The target-machine is gathered from the PE header (Win32 exe)
It's most likely a DOS exe if the target-machine is missing.



View the EXE header as text.
win32 EXEs will have "This program cannot be run in DOS mode." text in the header.

c:\window *.exe content-max-size:128 regex:binarycontent:(.*) addcol:regmatch1
void
Developer
Posts: 17152
Joined: Fri Oct 16, 2009 11:31 pm

Re: separate exe by types when searching

Post by void »

Everything 1.5.0.1388a adds READUINT32() to formulas.

To show if exe files have a PE header:

*.exe add-column:a a-label:PE a:=IF(READUINT32($filename:,READUINT32($filename:,0x3c))==0x00004550,"true","false")


Windows executables will have a PE header.
DOS executables will not have a PE header.



To search for PE exe files: (Windows executables)
*.exe READUINT32($filename:,READUINT32($filename:,0x3c))==0x00004550




To search for exe files without a PE header: (DOS executables)
*.exe READUINT32($filename:,READUINT32($filename:,0x3c))!=0x00004550
therube
Posts: 5056
Joined: Thu Sep 03, 2009 6:48 pm

Re: separate exe by types when searching

Post by therube »

While not stand-alone vs. installer, I needed to distinguish between x86, x64, & ARM64 .exe's (& .dll's), & what a mess that was (compared to when ARM was not in the equation).

MediaInfo-INSTALLER.bat:
(As it is, I need certain .exe/.dll, at certain bitness's, to update particular programs, & at this point, this is the most efficient way of doing it.)

Code: Select all

:: with MediaInfo 24.12, he changed things again ;-)   SjB 12-12-2024
:: now also packing ARM64 files in the installer, so (automatic rename) on extraction is no longer
:: determinable, so have to go through CONVOLUTIONS to do what was rather simple (-:


:: needed for the "multi-line" FOR (i believe)
@echo off
setlocal EnableDelayedExpansion



:: extract cli .exe, only
777  x  MediaInfo_CLI*.zip   -oCLI   MediaInfo.exe
mv      CLI\MediaInfo.exe            CLI\MediaInfo_CL.exe


:: extract GUI, fully
:: exe installer contains x86, x64 and ARM64 versions, -aou automatically renames files, _1, on overwrite condition
777  x  MediaInfo_GUI*.EXE   -oGUI   -aou
MD      GUI\mplayer
MD      GUI\mpv.net


:: ARM64 files are only in M*Info*.exe or M*Info*.dll,
::       so that's all we need to look at, & are not needed at all
for %%i in (GUI\M*Info*) do (
	\dev\sysinternals\sigcheck.exe %%i | \bin\unix\grep -q -e "ARM"
	if !errorlevel! EQU 0  echo  Found: ARM64, ZAP: %%i  &&  mv %%i %%i.ARM64
    )

mv      GUI\*.ARM64                  GUI\$PLUGINSDIR
echo ZAP'd ARM64


:: what is left is either x64 or 32-bit
for %%i in (GUI\*.exe GUI\*.dll) do (
	\dev\sysinternals\sigcheck.exe %%i | \bin\unix\grep -q -e "32-bit"
	if !errorlevel! EQU 0  echo  Found: 32-bit, x86: %%i  &&  mv %%i %%i.x86
    )

mv      GUI\*.x86                    GUI\$PLUGINSDIR
mv      GUI\$PLUGINSDIR\MediaInfo_?.dll.x86   GUI\mplayer\MediaInfo.dll
echo MOVE'd .x86


:: what is left now is x64, of which we need to clean up the names
"C:\DEV\RENAME\Bulk Rename Utility\BRC\BRC32.exe" /dir:GUI /regexp:(.*)_\d:\1 /execute /quiet
echo REN'd  .x64's as needed


COPY    GUI\MediaInfo.dll            GUI\mpv.net\
ATTRIB -a /s


:: ZAP uneeded (as far as i know, uneeded) files (MediaInfo_SparsePackage.msix, resources.pri)
mv      GUI\*.msix GUI\*.pri         GUI\$PLUGINSDIR

echo DONE :-)
PAUSE
:: remove "_\?" from file names, so xxx_1.txt ---> xxx.txt
:: ren or mv also works for a /complete/ filename (mv) or simple wildcards (ren)
:: if there were more then 1 file to deal with, BRC32.exe would do it
"C:\DEV\RENAME\Bulk Rename Utility\BRC\BRC32.exe" /dir:. /regexp:(.*)_\d:\1
:end
And I've got a mish-mosh of all kinds of commands/programs going on in there.
DOS, UNIX, third party...
Oh, & 777 (777.exe) is simply 7z.exe (7-zip), renamed.
NotNull
Posts: 5517
Joined: Wed May 24, 2017 9:22 pm

Re: separate exe by types when searching

Post by NotNull »

Code: Select all

ext:exe  add-column:target-machine
should help here.

Column values will roughly match these ones

therube wrote: Thu Dec 12, 2024 4:32 pm Oh, & 777 (777.exe) is simply 7z.exe (7-zip), renamed.
I would have bet that this was a "chmod 777" utiliy for Windows to give all rights to everyone...
Post Reply