ホーム › Security.Authentication.Identity › SecAllocateAndSetIPAddress
SecAllocateAndSetIPAddress
関数呼び出しコンテキストにIPアドレスを割り当てて設定する。
シグネチャ
// SspiCli.dll
#include <windows.h>
HRESULT SecAllocateAndSetIPAddress(
BYTE* lpIpAddress,
DWORD cchIpAddress,
INT* FreeCallContext
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| lpIpAddress | BYTE* | in |
| cchIpAddress | DWORD | in |
| FreeCallContext | INT* | out |
戻り値の型: HRESULT
各言語での呼び出し定義
// SspiCli.dll
#include <windows.h>
HRESULT SecAllocateAndSetIPAddress(
BYTE* lpIpAddress,
DWORD cchIpAddress,
INT* FreeCallContext
);[DllImport("SspiCli.dll", ExactSpelling = true)]
static extern int SecAllocateAndSetIPAddress(
IntPtr lpIpAddress, // BYTE*
uint cchIpAddress, // DWORD
out int FreeCallContext // INT* out
);<DllImport("SspiCli.dll", ExactSpelling:=True)>
Public Shared Function SecAllocateAndSetIPAddress(
lpIpAddress As IntPtr, ' BYTE*
cchIpAddress As UInteger, ' DWORD
<Out> ByRef FreeCallContext As Integer ' INT* out
) As Integer
End Function' lpIpAddress : BYTE*
' cchIpAddress : DWORD
' FreeCallContext : INT* out
Declare PtrSafe Function SecAllocateAndSetIPAddress Lib "sspicli" ( _
ByVal lpIpAddress As LongPtr, _
ByVal cchIpAddress As Long, _
ByRef FreeCallContext As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
SecAllocateAndSetIPAddress = ctypes.windll.sspicli.SecAllocateAndSetIPAddress
SecAllocateAndSetIPAddress.restype = ctypes.c_int
SecAllocateAndSetIPAddress.argtypes = [
ctypes.POINTER(ctypes.c_ubyte), # lpIpAddress : BYTE*
wintypes.DWORD, # cchIpAddress : DWORD
ctypes.POINTER(ctypes.c_int), # FreeCallContext : INT* out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('SspiCli.dll')
SecAllocateAndSetIPAddress = Fiddle::Function.new(
lib['SecAllocateAndSetIPAddress'],
[
Fiddle::TYPE_VOIDP, # lpIpAddress : BYTE*
-Fiddle::TYPE_INT, # cchIpAddress : DWORD
Fiddle::TYPE_VOIDP, # FreeCallContext : INT* out
],
Fiddle::TYPE_INT)#[link(name = "sspicli")]
extern "system" {
fn SecAllocateAndSetIPAddress(
lpIpAddress: *mut u8, // BYTE*
cchIpAddress: u32, // DWORD
FreeCallContext: *mut i32 // INT* out
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("SspiCli.dll")]
public static extern int SecAllocateAndSetIPAddress(IntPtr lpIpAddress, uint cchIpAddress, out int FreeCallContext);
"@
$api = Add-Type -MemberDefinition $sig -Name 'SspiCli_SecAllocateAndSetIPAddress' -Namespace Win32 -PassThru
# $api::SecAllocateAndSetIPAddress(lpIpAddress, cchIpAddress, FreeCallContext)#uselib "SspiCli.dll"
#func global SecAllocateAndSetIPAddress "SecAllocateAndSetIPAddress" sptr, sptr, sptr
; SecAllocateAndSetIPAddress varptr(lpIpAddress), cchIpAddress, varptr(FreeCallContext) ; 戻り値は stat
; lpIpAddress : BYTE* -> "sptr"
; cchIpAddress : DWORD -> "sptr"
; FreeCallContext : INT* out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "SspiCli.dll" #cfunc global SecAllocateAndSetIPAddress "SecAllocateAndSetIPAddress" var, int, var ; res = SecAllocateAndSetIPAddress(lpIpAddress, cchIpAddress, FreeCallContext) ; lpIpAddress : BYTE* -> "var" ; cchIpAddress : DWORD -> "int" ; FreeCallContext : INT* out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "SspiCli.dll" #cfunc global SecAllocateAndSetIPAddress "SecAllocateAndSetIPAddress" sptr, int, sptr ; res = SecAllocateAndSetIPAddress(varptr(lpIpAddress), cchIpAddress, varptr(FreeCallContext)) ; lpIpAddress : BYTE* -> "sptr" ; cchIpAddress : DWORD -> "int" ; FreeCallContext : INT* out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; HRESULT SecAllocateAndSetIPAddress(BYTE* lpIpAddress, DWORD cchIpAddress, INT* FreeCallContext) #uselib "SspiCli.dll" #cfunc global SecAllocateAndSetIPAddress "SecAllocateAndSetIPAddress" var, int, var ; res = SecAllocateAndSetIPAddress(lpIpAddress, cchIpAddress, FreeCallContext) ; lpIpAddress : BYTE* -> "var" ; cchIpAddress : DWORD -> "int" ; FreeCallContext : INT* out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; HRESULT SecAllocateAndSetIPAddress(BYTE* lpIpAddress, DWORD cchIpAddress, INT* FreeCallContext) #uselib "SspiCli.dll" #cfunc global SecAllocateAndSetIPAddress "SecAllocateAndSetIPAddress" intptr, int, intptr ; res = SecAllocateAndSetIPAddress(varptr(lpIpAddress), cchIpAddress, varptr(FreeCallContext)) ; lpIpAddress : BYTE* -> "intptr" ; cchIpAddress : DWORD -> "int" ; FreeCallContext : INT* out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
sspicli = windows.NewLazySystemDLL("SspiCli.dll")
procSecAllocateAndSetIPAddress = sspicli.NewProc("SecAllocateAndSetIPAddress")
)
// lpIpAddress (BYTE*), cchIpAddress (DWORD), FreeCallContext (INT* out)
r1, _, err := procSecAllocateAndSetIPAddress.Call(
uintptr(lpIpAddress),
uintptr(cchIpAddress),
uintptr(FreeCallContext),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HRESULTfunction SecAllocateAndSetIPAddress(
lpIpAddress: Pointer; // BYTE*
cchIpAddress: DWORD; // DWORD
FreeCallContext: Pointer // INT* out
): Integer; stdcall;
external 'SspiCli.dll' name 'SecAllocateAndSetIPAddress';result := DllCall("SspiCli\SecAllocateAndSetIPAddress"
, "Ptr", lpIpAddress ; BYTE*
, "UInt", cchIpAddress ; DWORD
, "Ptr", FreeCallContext ; INT* out
, "Int") ; return: HRESULT●SecAllocateAndSetIPAddress(lpIpAddress, cchIpAddress, FreeCallContext) = DLL("SspiCli.dll", "int SecAllocateAndSetIPAddress(void*, dword, void*)")
# 呼び出し: SecAllocateAndSetIPAddress(lpIpAddress, cchIpAddress, FreeCallContext)
# lpIpAddress : BYTE* -> "void*"
# cchIpAddress : DWORD -> "dword"
# FreeCallContext : INT* out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。