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

SaslSetContextOption

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

シグネチャ

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

HRESULT SaslSetContextOption(
    SecHandle* ContextHandle,
    DWORD Option,
    void* Value,
    DWORD Size
);

パラメーター

名前方向
ContextHandleSecHandle*in
OptionDWORDin
Valuevoid*in
SizeDWORDin

戻り値の型: HRESULT

各言語での呼び出し定義

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

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

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

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

var (
	secur32 = windows.NewLazySystemDLL("SECUR32.dll")
	procSaslSetContextOption = secur32.NewProc("SaslSetContextOption")
)

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