How do I find full details of the registers used by Windows calls from masm64

asked 2021-11-13T11:55:35.5+00:00
Ian turner 61 Reputation points

I am trying to learn assembler using Masm64 in VS2019. I have progressed quite wel, until I reached the current stage of wanting to call windows functions from my asm files. My problem is I cannot find any for of listing of the registers that need setting up before calling say printf() and all the other functions I am used to using in C , C++ and c# .

As an example, I tried to use gets, what should be a a simple call, but it crashes immediately on return from the call with "Access violation writing location 0x00000000FFFFFFFF". I already push and pop the normal registers before starting, and have tried using sub rsp, 40h, and mov rcx, offset buffer but it continues ot crash. Clearly I need to set some register(s) but have spent 3 days searching with google to find some documentation, but with no luck whatsoever, I just get the same old YouTube videos and StackOverflow results, none of which give me the answer I need.

Where can I find the relevant Windows (10) documentation to let me call these functions form my asm code ??.

Windows API - Win32
Windows API - Win32
A core set of Windows application programming interfaces (APIs) for desktop and server applications. Previously known as Win32 API.
1,887 questions
No comments
{count} votes

1 answer

Sort by: Most helpful
  1. answered 2021-11-15T02:39:20.617+00:00
    Xiaopo Yang - MSFT 5,821 Reputation points Microsoft Employee

    Have you seen x64 calling convention? You can also learn by generated Disassembly in VS studio.