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

SspiSetChannelBindingFlags

関数
SSPIのチャネルバインディングにフラグを設定する。
DLLSspiCli.dll呼出規約winapi

シグネチャ

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

HRESULT SspiSetChannelBindingFlags(
    SecPkgContext_Bindings* pBindings,
    DWORD flags
);

パラメーター

名前方向
pBindingsSecPkgContext_Bindings*inout
flagsDWORDin

戻り値の型: HRESULT

各言語での呼び出し定義

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

HRESULT SspiSetChannelBindingFlags(
    SecPkgContext_Bindings* pBindings,
    DWORD flags
);
[DllImport("SspiCli.dll", ExactSpelling = true)]
static extern int SspiSetChannelBindingFlags(
    IntPtr pBindings,   // SecPkgContext_Bindings* in/out
    uint flags   // DWORD
);
<DllImport("SspiCli.dll", ExactSpelling:=True)>
Public Shared Function SspiSetChannelBindingFlags(
    pBindings As IntPtr,   ' SecPkgContext_Bindings* in/out
    flags As UInteger   ' DWORD
) As Integer
End Function
' pBindings : SecPkgContext_Bindings* in/out
' flags : DWORD
Declare PtrSafe Function SspiSetChannelBindingFlags Lib "sspicli" ( _
    ByVal pBindings As LongPtr, _
    ByVal flags As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

SspiSetChannelBindingFlags = ctypes.windll.sspicli.SspiSetChannelBindingFlags
SspiSetChannelBindingFlags.restype = ctypes.c_int
SspiSetChannelBindingFlags.argtypes = [
    ctypes.c_void_p,  # pBindings : SecPkgContext_Bindings* in/out
    wintypes.DWORD,  # flags : DWORD
]
require 'fiddle'
require 'fiddle/import'

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

var (
	sspicli = windows.NewLazySystemDLL("SspiCli.dll")
	procSspiSetChannelBindingFlags = sspicli.NewProc("SspiSetChannelBindingFlags")
)

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