ホーム › NetworkManagement.IpHelper › GetSessionCompartmentId
GetSessionCompartmentId
関数指定したセッションに関連付けられたコンパートメントIDを取得する。
シグネチャ
// IPHLPAPI.dll
#include <windows.h>
NET_IF_COMPARTMENT_ID GetSessionCompartmentId(
DWORD SessionId
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| SessionId | DWORD | in |
戻り値の型: NET_IF_COMPARTMENT_ID
各言語での呼び出し定義
// IPHLPAPI.dll
#include <windows.h>
NET_IF_COMPARTMENT_ID GetSessionCompartmentId(
DWORD SessionId
);[DllImport("IPHLPAPI.dll", ExactSpelling = true)]
static extern uint GetSessionCompartmentId(
uint SessionId // DWORD
);<DllImport("IPHLPAPI.dll", ExactSpelling:=True)>
Public Shared Function GetSessionCompartmentId(
SessionId As UInteger ' DWORD
) As UInteger
End Function' SessionId : DWORD
Declare PtrSafe Function GetSessionCompartmentId Lib "iphlpapi" ( _
ByVal SessionId As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
GetSessionCompartmentId = ctypes.windll.iphlpapi.GetSessionCompartmentId
GetSessionCompartmentId.restype = wintypes.DWORD
GetSessionCompartmentId.argtypes = [
wintypes.DWORD, # SessionId : DWORD
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('IPHLPAPI.dll')
GetSessionCompartmentId = Fiddle::Function.new(
lib['GetSessionCompartmentId'],
[
-Fiddle::TYPE_INT, # SessionId : DWORD
],
-Fiddle::TYPE_INT)#[link(name = "iphlpapi")]
extern "system" {
fn GetSessionCompartmentId(
SessionId: u32 // DWORD
) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("IPHLPAPI.dll")]
public static extern uint GetSessionCompartmentId(uint SessionId);
"@
$api = Add-Type -MemberDefinition $sig -Name 'IPHLPAPI_GetSessionCompartmentId' -Namespace Win32 -PassThru
# $api::GetSessionCompartmentId(SessionId)#uselib "IPHLPAPI.dll"
#func global GetSessionCompartmentId "GetSessionCompartmentId" sptr
; GetSessionCompartmentId SessionId ; 戻り値は stat
; SessionId : DWORD -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "IPHLPAPI.dll"
#cfunc global GetSessionCompartmentId "GetSessionCompartmentId" int
; res = GetSessionCompartmentId(SessionId)
; SessionId : DWORD -> "int"; NET_IF_COMPARTMENT_ID GetSessionCompartmentId(DWORD SessionId)
#uselib "IPHLPAPI.dll"
#cfunc global GetSessionCompartmentId "GetSessionCompartmentId" int
; res = GetSessionCompartmentId(SessionId)
; SessionId : DWORD -> "int"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
iphlpapi = windows.NewLazySystemDLL("IPHLPAPI.dll")
procGetSessionCompartmentId = iphlpapi.NewProc("GetSessionCompartmentId")
)
// SessionId (DWORD)
r1, _, err := procGetSessionCompartmentId.Call(
uintptr(SessionId),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // NET_IF_COMPARTMENT_IDfunction GetSessionCompartmentId(
SessionId: DWORD // DWORD
): DWORD; stdcall;
external 'IPHLPAPI.dll' name 'GetSessionCompartmentId';result := DllCall("IPHLPAPI\GetSessionCompartmentId"
, "UInt", SessionId ; DWORD
, "UInt") ; return: NET_IF_COMPARTMENT_ID●GetSessionCompartmentId(SessionId) = DLL("IPHLPAPI.dll", "dword GetSessionCompartmentId(dword)")
# 呼び出し: GetSessionCompartmentId(SessionId)
# SessionId : DWORD -> "dword"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。