Source file src/internal/runtime/syscall/windows/syscall_windows.go

     1  // Copyright 2025 The Go Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  // Package windows provides the syscall primitives required for the runtime.
     6  
     7  package windows
     8  
     9  import (
    10  	"internal/abi"
    11  )
    12  
    13  // StdCallInfo is a structure used to pass parameters to the system call.
    14  type StdCallInfo struct {
    15  	Fn   uintptr
    16  	N    uintptr // number of parameters
    17  	Args uintptr // parameters
    18  	R1   uintptr // return values
    19  	R2   uintptr
    20  }
    21  
    22  // StdCall calls a function using Windows' stdcall convention.
    23  // The calling thread's last-error code value is cleared before calling the function,
    24  // and stored in the return value.
    25  //
    26  //go:noescape
    27  func StdCall(fn *StdCallInfo) uint32
    28  
    29  // asmstdcall is the function pointer for [AsmStdCallAddr].
    30  // The calling thread's last-error code value is cleared before calling the function,
    31  // and returned in the C ABI return register (not via Go stack convention).
    32  // This function is not called directly from Go; it is either jumped to from
    33  // [StdCall] or called from C via [AsmStdCallAddr].
    34  func asmstdcall(fn *StdCallInfo)
    35  
    36  // AsmStdCallAddr is the address of a function that accepts a pointer
    37  // to [StdCallInfo] stored on the stack following the C calling convention,
    38  // and calls the function using Windows' stdcall calling convention.
    39  // Shouldn't be called directly from Go.
    40  func AsmStdCallAddr() uintptr {
    41  	return abi.FuncPCABI0(asmstdcall)
    42  }
    43  

View as plain text