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