Live data from Hacker News

Show HN: Tiny 1k Rust binary on Windows

github.com

1–10 of 66 posts

Re: Show HN: Tiny 1k Rust binary on Windows

#4

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.

That's a DOS executable though, and won't run on 64-bit Windows.

Re: Show HN: Tiny 1k Rust binary on Windows

#6

I have found this https://github.com/HugoPlatzer/tiny-rust-binaries . Can you test it and see how it behaves with msvc toolchain?

That contains a lot of platform-specific build instructions for Linux (and for the ELF file format used on Linux but not Windows), so it's never going to work with the msvc toolchain.

Re: Show HN: Tiny 1k Rust binary on Windows

#7
post #4

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.

That's a DOS executable though, and won't run on 64-bit Windows.

Not out of the box but with something like vDos it should.

Re: Show HN: Tiny 1k Rust binary on Windows

#8
post #4

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.

That's a DOS executable though, and won't run on 64-bit Windows.

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

#9
post #4

Earlier quoted context omitted.

That's a DOS executable though, and won't run on 64-bit Windows.

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?

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

#10
post #4

Earlier quoted context omitted.

That's a DOS executable though, and won't run on 64-bit Windows.

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?

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...

Post reply on HN