News for hackers. Stuff that matters.
Re:Show HN: Tiny 1k Rust binary on Windows by mytailorisrich on Tuesday December 01, 2020 @05:50AM (#25264137)
On Windows the smallest exe can be achieved by writing in assembly and compiling as .com executable.

These literally just contain the compiled assembly and are usually used on, for example, the 4k demoscene.

1k with rust is certainly a nice squeeze.

Re:Show HN: Tiny 1k Rust binary on Windows by jariRG on Tuesday December 01, 2020 @06:49AM (#25264407)
The size limited demos are use techniques like in the OP, scrapping the runtime, no std, filling the unused exe header sections with own data, quantizing floating point values, etc. And/or exe packers like Crinkler and kkrunchy. COM's are no longer used.
Re:Show HN: Tiny 1k Rust binary on Windows by poizan42 on Tuesday December 01, 2020 @05:52AM (#25264149)
That's a DOS executable though, and won't run on 64-bit Windows.
Re:Show HN: Tiny 1k Rust binary on Windows by mytailorisrich on Tuesday December 01, 2020 @06:18AM (#25264280)
Not out of the box but with something like vDos it should.
Re:Show HN: Tiny 1k Rust binary on Windows by weinzierl on Tuesday December 01, 2020 @06:25AM (#25264310)
Regular com programs won't run, but I'm waiting for the day the vulnerability is discovered that let's you run a specially crafted binary because of left over code from the old com launcher. Is the com extension still recognized in 64-bit windows?
Re:Show HN: Tiny 1k Rust binary on Windows by poizan42 on Tuesday December 01, 2020 @06:38AM (#25264368)
Considering that COM programs are headerless I can't imagine any way a specially crafted binary could do anything since there is no parsing going on. The "COM loader" just hands it off to NTVDM which does not exist on 64-bit Windows (there are 3rd-party implementations though)

And yes, the com extension is still recognized and will pop up a dialog telling you "This app can't run on your PC".

But actually .com and .exe files are handled equivalently, so you can just rename an .exe (i.e. PE executable) to .com and it will run - that doesn't make it a COM executable though...

Re:Show HN: Tiny 1k Rust binary on Windows by zinekeller on Tuesday December 01, 2020 @06:31AM (#25264346)
No, like really impossible on a hardware level (most 16-bit instructions are hidden on hardware level on entering 64-bit mode) and on a software level (NTVDM is separate from Windows NT from day one (since it only works on x86 hardware and not on DEC Alpha for example) and it was an optional component since Vista but only on an x86 installation though).
Re:Show HN: Tiny 1k Rust binary on Windows by userbinator on Tuesday December 01, 2020 @09:40AM (#25265531)
These literally just contain the compiled assembly and are usually used on, for example, the 4k demoscene.

There are plenty of 1k demos too, on Windows and otherwise:

http://www.pouet.net/prodlist.php?type%5B%5D=1k