this post was submitted on 17 Mar 2026
50 points (96.3% liked)

Programmer Humor

30442 readers
1803 users here now

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

founded 2 years ago
MODERATORS
 

An implementation of sudo for DOS, to run the given command with full privileges. It can be used to edit important system files, run disk partitioning tools, and so on!

top 20 comments
sorted by: hot top controversial new old
[–] umbraroze@slrpnk.net 15 points 1 day ago (1 children)

Real joke: Being advertised as .com file, actually compiles to .exe format (which is funnier because by later DOS versions a lot of the .com files that came with DOS were actually .exe files)

[–] raman_klogius@ani.social 11 points 1 day ago (2 children)

Fun fact: all Windows exe files are also com files. They all have a dos running part, most of which simply prints "this program cannot be run in dos nice" and exits, but some programs do have fully functional dos program as well as the usual windows GUI part.

[–] umbraroze@slrpnk.net 2 points 11 hours ago (1 children)

I actually first thought that was weird and wasteful. Then I remembered that, uh, Commodore 64 often uses a similar thing. Basically, a lot of assembly and compiled languages just put the machine code into the BASIC memory, preceded by a stub BASIC program that's basically just "10 SYS addr" with that address pointing just past the end of the stub program itself. BASIC's LOAD command handles it just fine because program files don't have any header information besides load address. BASIC handles the loaded program just normally because the program has the end token, so as long as you don't modify the BASIC program, it'll be fine.

[–] sjmulder@lemmy.sdf.org 1 points 11 hours ago

Luckily the .exe's MZ header is pretty small. But in this case it was necessary: when DOS loads a .com binary, it can't know how much memory it will need, so DOS just gives it all free memory. But then the program can't launch another, because all memory is in use. So that's why I had to add the MZ header which allows specifying the memory needs.

[–] Scoopta@programming.dev 6 points 1 day ago (1 children)

Technically that segment is not a com file. They are MZ exe files. com files have no metadata or header

[–] otacon239@lemmy.world 7 points 23 hours ago

You could say any arrangement of words or letters about the inner workings of Windows, and I’d probably just take your word for it at this point.

[–] db2@lemmy.world 16 points 1 day ago

If a file SUDOERS.SYS is present in the root directory of the boot drive, it is ignored.

Just like Microslop would have done it!

[–] boredsquirrel@slrpnk.net 4 points 1 day ago

ReactOS developers starting to heavily take notes

[–] Scoopta@programming.dev 5 points 1 day ago

The interpreter is then executed in unprotected real mode for full privileges. Good thing I'm running sudo from real mode so it can elevate me to real mode

[–] daychilde@lemmy.world 2 points 1 day ago (1 children)

Interesting timing since there is sudo in one of the latest Windows preview builds…

[–] KairuByte@lemmy.dbzer0.com 3 points 13 hours ago (1 children)

M$ sudo has been around for a while as a dev setting iirc.

[–] daychilde@lemmy.world 1 points 13 hours ago (1 children)

Microsoft officially introduced a native sudo command for Windows with the release of Windows 11 Insider Preview Build 26052, which was announced on February 8, 2024.

That, to me, is "recently". :)

[–] KairuByte@lemmy.dbzer0.com 0 points 12 hours ago (1 children)

It was released into the wild in 242H, so around a year or two ago.

[–] daychilde@lemmy.world 1 points 12 hours ago

I'm… not going to argue with someone basically reiterating the same exact things I'm saying.

[–] SubArcticTundra@lemmy.ml 3 points 1 day ago (2 children)

I thought DOS didn't have users, meaning you were root by default

[–] refalo@programming.dev 3 points 1 day ago

Yep, the project must be a joke because the code doesn't actually do anything besides run the specified program normally.

[–] Buelldozer@lemmy.today 1 points 1 day ago (1 children)

This isn't about user permissions, its about the operating mode of the CPU.

[–] SubArcticTundra@lemmy.ml 3 points 1 day ago

Please, ELI5

[–] PodPerson@lemmy.zip 0 points 1 day ago (1 children)

Since when did DOS have any system level permissions? Maybe something after version 6 but I thought literally anyone could run anything at any time. Was a loooooooooong time ago though so I’m probably wrong.

[–] refalo@programming.dev 4 points 1 day ago

It doesn't, pretty sure the repo is a joke. Their code doesn't do anything special, just runs the program you give it.