Win32 API 日本語リファレンス
ホームSecurity.Authentication.Identity › SaslGetContextOption

SaslGetContextOption

関数
SASLコンテキストのオプション値を取得する。
DLLSECUR32.dll呼出規約winapi対応OSwindowsserver2003

シグネチャ

// SECUR32.dll
#include <windows.h>

HRESULT SaslGetContextOption(
    SecHandle* ContextHandle,
    DWORD Option,
    void* Value,
    DWORD Size,
    DWORD* Needed   // optional
);

パラメーター

名前方向
ContextHandleSecHandle*in
OptionDWORDin
Valuevoid*out
SizeDWORDin
NeededDWORD*outoptional

戻り値の型: HRESULT

各言語での呼び出し定義

// SECUR32.dll
#include <windows.h>

HRESULT SaslGetContextOption(
    SecHandle* ContextHandle,
    DWORD Option,
    void* Value,
    DWORD Size,
    DWORD* Needed   // optional
);
[DllImport("SECUR32.dll", ExactSpelling = true)]
static extern int SaslGetContextOption(
    IntPtr ContextHandle,   // SecHandle*
    uint Option,   // DWORD
    IntPtr Value,   // void* out
    uint Size,   // DWORD
    IntPtr Needed   // DWORD* optional, out
);
<DllImport("SECUR32.dll", ExactSpelling:=True)>
Public Shared Function SaslGetContextOption(
    ContextHandle As IntPtr,   ' SecHandle*
    [Option] As UInteger,   ' DWORD
    Value As IntPtr,   ' void* out
    Size As UInteger,   ' DWORD
    Needed As IntPtr   ' DWORD* optional, out
) As Integer
End Function
' ContextHandle : SecHandle*
' Option : DWORD
' Value : void* out
' Size : DWORD
' Needed : DWORD* optional, out
Declare PtrSafe Function SaslGetContextOption Lib "secur32" ( _
    ByVal ContextHandle As LongPtr, _
    ByVal Option As Long, _
    ByVal Value As LongPtr, _
    ByVal Size As Long, _
    ByVal Needed As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

SaslGetContextOption = ctypes.windll.secur32.SaslGetContextOption
SaslGetContextOption.restype = ctypes.c_int
SaslGetContextOption.argtypes = [
    ctypes.c_void_p,  # ContextHandle : SecHandle*
    wintypes.DWORD,  # Option : DWORD
    ctypes.POINTER(None),  # Value : void* out
    wintypes.DWORD,  # Size : DWORD
    ctypes.POINTER(wintypes.DWORD),  # Needed : DWORD* optional, out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('SECUR32.dll')
SaslGetContextOption = Fiddle::Function.new(
  lib['SaslGetContextOption'],
  [
    Fiddle::TYPE_VOIDP,  # ContextHandle : SecHandle*
    -Fiddle::TYPE_INT,  # Option : DWORD
    Fiddle::TYPE_VOIDP,  # Value : void* out
    -Fiddle::TYPE_INT,  # Size : DWORD
    Fiddle::TYPE_VOIDP,  # Needed : DWORD* optional, out
  ],
  Fiddle::TYPE_INT)
#[link(name = "secur32")]
extern "system" {
    fn SaslGetContextOption(
        ContextHandle: *mut SecHandle,  // SecHandle*
        Option: u32,  // DWORD
        Value: *mut (),  // void* out
        Size: u32,  // DWORD
        Needed: *mut u32  // DWORD* optional, out
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("SECUR32.dll")]
public static extern int SaslGetContextOption(IntPtr ContextHandle, uint Option, IntPtr Value, uint Size, IntPtr Needed);
"@
$api = Add-Type -MemberDefinition $sig -Name 'SECUR32_SaslGetContextOption' -Namespace Win32 -PassThru
# $api::SaslGetContextOption(ContextHandle, Option, Value, Size, Needed)
#uselib "SECUR32.dll"
#func global SaslGetContextOption "SaslGetContextOption" sptr, sptr, sptr, sptr, sptr
; SaslGetContextOption varptr(ContextHandle), Option, Value, Size, varptr(Needed)   ; 戻り値は stat
; ContextHandle : SecHandle* -> "sptr"
; Option : DWORD -> "sptr"
; Value : void* out -> "sptr"
; Size : DWORD -> "sptr"
; Needed : DWORD* optional, out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "SECUR32.dll"
#cfunc global SaslGetContextOption "SaslGetContextOption" var, int, sptr, int, var
; res = SaslGetContextOption(ContextHandle, Option, Value, Size, Needed)
; ContextHandle : SecHandle* -> "var"
; Option : DWORD -> "int"
; Value : void* out -> "sptr"
; Size : DWORD -> "int"
; Needed : DWORD* optional, out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; HRESULT SaslGetContextOption(SecHandle* ContextHandle, DWORD Option, void* Value, DWORD Size, DWORD* Needed)
#uselib "SECUR32.dll"
#cfunc global SaslGetContextOption "SaslGetContextOption" var, int, intptr, int, var
; res = SaslGetContextOption(ContextHandle, Option, Value, Size, Needed)
; ContextHandle : SecHandle* -> "var"
; Option : DWORD -> "int"
; Value : void* out -> "intptr"
; Size : DWORD -> "int"
; Needed : DWORD* optional, out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	secur32 = windows.NewLazySystemDLL("SECUR32.dll")
	procSaslGetContextOption = secur32.NewProc("SaslGetContextOption")
)

// ContextHandle (SecHandle*), Option (DWORD), Value (void* out), Size (DWORD), Needed (DWORD* optional, out)
r1, _, err := procSaslGetContextOption.Call(
	uintptr(ContextHandle),
	uintptr(Option),
	uintptr(Value),
	uintptr(Size),
	uintptr(Needed),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // HRESULT
function SaslGetContextOption(
  ContextHandle: Pointer;   // SecHandle*
  Option: DWORD;   // DWORD
  Value: Pointer;   // void* out
  Size: DWORD;   // DWORD
  Needed: Pointer   // DWORD* optional, out
): Integer; stdcall;
  external 'SECUR32.dll' name 'SaslGetContextOption';
result := DllCall("SECUR32\SaslGetContextOption"
    , "Ptr", ContextHandle   ; SecHandle*
    , "UInt", Option   ; DWORD
    , "Ptr", Value   ; void* out
    , "UInt", Size   ; DWORD
    , "Ptr", Needed   ; DWORD* optional, out
    , "Int")   ; return: HRESULT
●SaslGetContextOption(ContextHandle, Option, Value, Size, Needed) = DLL("SECUR32.dll", "int SaslGetContextOption(void*, dword, void*, dword, void*)")
# 呼び出し: SaslGetContextOption(ContextHandle, Option, Value, Size, Needed)
# ContextHandle : SecHandle* -> "void*"
# Option : DWORD -> "dword"
# Value : void* out -> "void*"
# Size : DWORD -> "dword"
# Needed : DWORD* optional, out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。