this post was submitted on 03 Aug 2024
1068 points (99.1% liked)

Programmer Humor

32706 readers
534 users here now

Post funny things about programming here! (Or just rant about your favourite programming language.)

Rules:

founded 5 years ago
MODERATORS
1068
submitted 4 months ago* (last edited 4 months ago) by [email protected] to c/[email protected]
 
you are viewing a single comment's thread
view the rest of the comments
[–] [email protected] 1 points 4 months ago (1 children)

I'm sorry, I have no idea what you're talking about. Could you explain it in assembly?

[–] [email protected] 5 points 4 months ago* (last edited 4 months ago) (1 children)
global _main
    extern  _GetStdHandle@4
    extern  _WriteFile@20
    extern  _ExitProcess@4

    section .text
_main:
    ; DWORD  bytes;    
    mov     ebp, esp
    sub     esp, 4

    ; hStdOut = GetstdHandle( STD_OUTPUT_HANDLE)
    push    -11
    call    _GetStdHandle@4
    mov     ebx, eax    

    ; WriteFile( hstdOut, message, length(message), &bytes, 0);
    push    0
    lea     eax, [ebp-4]
    push    eax
    push    (message_end - message)
    push    message
    push    ebx
    call    _WriteFile@20

    ; ExitProcess(0)
    push    0
    call    _ExitProcess@4

    ; never here
    hlt
message:
    db      '¯\\\_(ツ)\_/¯', 10
message_end:
[–] lightscription 1 points 4 months ago* (last edited 4 months ago)

Do you want to show us what that looks like in assembly, ASCII from machine code? ...ha, ha, ha, no!

Depends on the device, I know. Such a pain without the higher level languages.

What would it look like for ARM android touch screens? Just for one character...

But if some characters go missing or are exchanged for others for no discernable reason, then might that be an exploit on a EC or assembly level?