News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests

Main Menu

Tiniet portable executable

Started by DaviFN, June 05, 2018, 12:23:26 AM

Previous topic - Next topic

DaviFN

Hi everyone!

I've been, for the past days, searching for the smallest executable for Windows. The reason is that I want to start a small macro for a game (basically just presses a key and maybe draw some pixels on screen), and I'd like it to be tiny, just for the sake of it. I'll not use NASM, however; I intend to use Ollydbg or another such tool to directly "code" in the executable itself (sort of like a challenge).

I searched the web for the smallest executable, and it appears to be 97 bytes large. I couldn't find it for download, but I don't think it would run in any version of Windows (I want it to run from XP up (XP,7,8,10)). I found one called "hh2 golden.exe" (~400 bytes), which apparently runs from XP up, but it prints "Hello World!" in the screen (I'd like one that did nothing).

Also, I couldn't assemble them (I don't know how to properly use MASM). I'd use "hh2 golden.exe", but then I had the idea to ask here if one of you guys have a better executable that I could use in this adventure.

tl;dr: I'm asking for the smallest executable capable of running from winXP up. Preferrably it does nothing, since I want to modify it and put some functionality to it (but I need it to be completely clear at the beginning)

Thanks!

aw27

There is a thread somewhere about that (found it):
http://masm32.com/board/index.php?topic=6595.0

hutch--

If its tiny 16 bit DOS COM files, you can make a reboot COM file at 2 bytes. Win Win32, depending on the OS version you can go under the 2 x 512 byte sections but it risks being unreliable and may not work on all Windows versions. Write your own custom MZ stub and also set the section size in the linker until it won't run then tweak it it back up a little. It is an exercise in futility as you can't get a 32 bit PE file to do anything useful at under 2 x 512 byte sections. There is a full working windows in the MASM32 example code that builds at 1k and that is about the bottom limit for anything that may be useful.

DaviFN

Would it be too much if I asked for someone to upload a small win32 executable (the smaller, the better) capable of running in Windows XP, 7, 8 & 10? (As I said, I just want a working .exe in order to start modifying it and make it do what I want it to do, e.g. repeatedly press a key)

Thank you anyway!

felipe

You want to modify the exe or the source?  :idea:

DaviFN

I want to modify the .exe directly. That is why I want sort of a "scratch", an empty executable that does nothing. I want it to work in Win XP, 7, 8 and 10 (mainly 32 bits, but working on 64 too would be nice). The smaller it is, the better (I don't want irrelevant bytes).

I'll then use Cheat Engine & OllyDBG in order to modify it. I'll keep modifying until I make it do what I want it to do (something simple, like pressing a key).

Vortex

Hi DaviFN,

Welcome to the Masm Forum.

How are you sure that your code will fit into the code section of the tiny executable?

zedd151

Quote from: DaviFN on June 05, 2018, 04:44:04 AM

...I'll then use Cheat Engine & OllyDBG in order to modify it. I'll keep modifying until I make it do what I want it to do...

Why don't you just learn a little bit of Masm32, and program what you need the right way. Then you can optimize it to you hearts content. For size, speed, or whatever floats your boat.   8)

Coding directly with olly is rather tedious, prone to error, etc.

Oh, and welcome the the Masm32 forum.   :icon14:

DaviFN

It won't fit in the code section. So I'll force it to jump to the end of the executable and continue from there.

DaviFN

I guess I like seing the whole file, and being able to have full control over it. MASM would do it, too, but I could simply code it in C. As I said, I want sort of like a challenge.

Thank you for the welcome!

zedd151

Quote from: DaviFN on June 05, 2018, 06:17:02 AM
It won't fit in the code section. So I'll force it to jump to the end of the executable and continue from there.

That will surely trigger anti-virus scanners.
You're not writing a virus or other malware are you? Because having a small code section and jumping outside of it will make the virus detection algos flag your 'program' as a virus, or other malware.

It's better to program what you need correctly as to not trigger AV software.

And if you continue outside of the executable, will probably trigger a page fault.

DaviFN

I didn't know that. I'm not writing malware, just a macro that will keep pressing a key when a variable is set, and that variable would be toggled by pressing a key. But there must be a way to expand the code section...

zedd151

Quote from: DaviFN on June 05, 2018, 06:26:05 AM
I didn't know that. I'm not writing malware, just a macro that will keep pressing a key when a variable is set, and that variable would be toggled by pressing a key. But there must be a way to expand the code section...

you can, using a hex editor. keep in mind that x86 executables are aligned to 200h bytes. So if you increase the code section, it should be by 200h bytes. Then if you also have a .data or imports, or .rsrc  section, the section headers should be adjusted according to the new .text section size.

;)

That's about all I have to say about that.   8)

felipe

 :eusa_snooty: MMM don't know don't know, sounds a little suspicious to me...Sorry i will not help you with this odd project... :idea:

But welcome to the forum anyway  :P. Try to read well the forum rules... :idea:

DaviFN

I just got inspired from that .kkrieger game (96 KB) and wanted to dive in this adventure of creating a small, useful executable. The game itself states "macros are allowed", and this specific macro I'll create is the most used one; the so-called "auto potion"; just presses Q, W and E indefinitely.

I understand the suspiction, though. I could quickly code a C program to do that. Just wanted some challenge.