Hey i'm writing this code but rn i can't get it to work, here it is:
clr PROC
SUB RSP, 40
MOV RCX, stdout
MOVZX RAX, csbi.dwSize.X
MOVZX RBX, csbi.dwSize.Y
MUL RBX
MOV RDX, 32
MOV R8, RAX
XOR R9, R9
MOV num, 0
LEA RAX, num
mov QWORD PTR [RSP + 32], RAX
CALL FillConsoleOutputCharacterA
ADD RSP, 40
RET
clr ENDP
variables here:
num DWORD ?
csbi CONSOLE_SCREEN_BUFFER_INFO <> (exactly like in the windows docs, i know it works cuz i use it to get the size)
Also I'm not using the SDK because i'm following a challenge of not using any external code.
Offhand I would say we need more information. Are you using GetConsoleScreenBufferInfo to fill the CONSOLE_SCREEN_BUFFER_INFO structure? Is the structure getting filled properly? Is the handle to stdout valid?
Perhaps post the (pertinent) code that you used prior to calling your clr procedure??
Have you stepped the code in a debugger? (While watching return values in rax and watching whether or not any exceptions are found)
Quote from: zedd on June 21, 2025, 11:16:28 PMOffhand I would say we need more information. Are you using GetConsoleScreenBufferInfo to fill the CONSOLE_SCREEN_BUFFER_INFO structure? Is the structure getting filled properly? Is the handle to stdout valid?
Perhaps post the (pertinent) code that you used prior to calling your clr procedure??
Have you stepped the code in a debugger? (While watching return values in rax and watching whether or not any exceptions are found)
It just started working after I did absolutely nothing sorry for wasting your time
And to answer your questions I did use the GetConsoleScreenBufferInfo and made sure it works and I use VS Community 2022 to watch the registers, function returns 1 so i guess no errors
Quote from: sskaiser on June 22, 2025, 01:36:29 AMsorry for wasting your time
Its not wasted time. As I do not know your level of experience, I must ask seemingly silly questions sometimes.
Quote from: sskaiser on June 22, 2025, 01:38:34 AMAnd to answer your questions I did use the GetConsoleScreenBufferInfo and made sure it works...
:thumbsup:
Quoteand I use VS Community 2022 to watch the registers, function returns 1 so i guess no errors
Okay. :smiley:
Well, it looks to me as if you haven't figured out why it didn't work in the first place, so you've learned nothing. Poking code here and there in hopes it might work isn't the way to learn how to code.
Plus, any reason you're using 64-bit assembly? 32-bit is much easier and more straightforward, plus the MASM32 package is pretty complete and robust, unlike MASM64 which is kind of a piece of shit at this time.