Win32 API 日本語リファレンス
ホームSystem.RemoteManagement › WSManPluginAuthzOperationComplete

WSManPluginAuthzOperationComplete

関数
プラグインの操作認可処理の完了を通知する。
DLLWsmSvc.dll呼出規約winapi対応OSWindows 7 以降

シグネチャ

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

DWORD WSManPluginAuthzOperationComplete(
    WSMAN_SENDER_DETAILS* senderDetails,
    DWORD flags,
    void* userAuthorizationContext,   // optional
    DWORD errorCode,
    LPCWSTR extendedErrorInformation   // optional
);

パラメーター

名前方向説明
senderDetailsWSMAN_SENDER_DETAILS*in送信者の認証情報を保持する WSMAN_SENDER_DETAILS 構造体へのポインター。
flagsDWORDin認可動作を制御するフラグ。
userAuthorizationContextvoid*inoptionalユーザー認可に関連付けるコンテキストへのポインター。
errorCodeDWORDin操作の認可結果を示すエラーコード。成功時は NO_ERROR を指定する。
extendedErrorInformationLPCWSTRinoptionalエラーの詳細を示す拡張情報のXML文字列。NULL 可。

戻り値の型: DWORD

各言語での呼び出し定義

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

DWORD WSManPluginAuthzOperationComplete(
    WSMAN_SENDER_DETAILS* senderDetails,
    DWORD flags,
    void* userAuthorizationContext,   // optional
    DWORD errorCode,
    LPCWSTR extendedErrorInformation   // optional
);
[DllImport("WsmSvc.dll", ExactSpelling = true)]
static extern uint WSManPluginAuthzOperationComplete(
    IntPtr senderDetails,   // WSMAN_SENDER_DETAILS*
    uint flags,   // DWORD
    IntPtr userAuthorizationContext,   // void* optional
    uint errorCode,   // DWORD
    [MarshalAs(UnmanagedType.LPWStr)] string extendedErrorInformation   // LPCWSTR optional
);
<DllImport("WsmSvc.dll", ExactSpelling:=True)>
Public Shared Function WSManPluginAuthzOperationComplete(
    senderDetails As IntPtr,   ' WSMAN_SENDER_DETAILS*
    flags As UInteger,   ' DWORD
    userAuthorizationContext As IntPtr,   ' void* optional
    errorCode As UInteger,   ' DWORD
    <MarshalAs(UnmanagedType.LPWStr)> extendedErrorInformation As String   ' LPCWSTR optional
) As UInteger
End Function
' senderDetails : WSMAN_SENDER_DETAILS*
' flags : DWORD
' userAuthorizationContext : void* optional
' errorCode : DWORD
' extendedErrorInformation : LPCWSTR optional
Declare PtrSafe Function WSManPluginAuthzOperationComplete Lib "wsmsvc" ( _
    ByVal senderDetails As LongPtr, _
    ByVal flags As Long, _
    ByVal userAuthorizationContext As LongPtr, _
    ByVal errorCode As Long, _
    ByVal extendedErrorInformation As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

WSManPluginAuthzOperationComplete = ctypes.windll.wsmsvc.WSManPluginAuthzOperationComplete
WSManPluginAuthzOperationComplete.restype = wintypes.DWORD
WSManPluginAuthzOperationComplete.argtypes = [
    ctypes.c_void_p,  # senderDetails : WSMAN_SENDER_DETAILS*
    wintypes.DWORD,  # flags : DWORD
    ctypes.POINTER(None),  # userAuthorizationContext : void* optional
    wintypes.DWORD,  # errorCode : DWORD
    wintypes.LPCWSTR,  # extendedErrorInformation : LPCWSTR optional
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('WsmSvc.dll')
WSManPluginAuthzOperationComplete = Fiddle::Function.new(
  lib['WSManPluginAuthzOperationComplete'],
  [
    Fiddle::TYPE_VOIDP,  # senderDetails : WSMAN_SENDER_DETAILS*
    -Fiddle::TYPE_INT,  # flags : DWORD
    Fiddle::TYPE_VOIDP,  # userAuthorizationContext : void* optional
    -Fiddle::TYPE_INT,  # errorCode : DWORD
    Fiddle::TYPE_VOIDP,  # extendedErrorInformation : LPCWSTR optional
  ],
  -Fiddle::TYPE_INT)
#[link(name = "wsmsvc")]
extern "system" {
    fn WSManPluginAuthzOperationComplete(
        senderDetails: *mut WSMAN_SENDER_DETAILS,  // WSMAN_SENDER_DETAILS*
        flags: u32,  // DWORD
        userAuthorizationContext: *mut (),  // void* optional
        errorCode: u32,  // DWORD
        extendedErrorInformation: *const u16  // LPCWSTR optional
    ) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("WsmSvc.dll")]
public static extern uint WSManPluginAuthzOperationComplete(IntPtr senderDetails, uint flags, IntPtr userAuthorizationContext, uint errorCode, [MarshalAs(UnmanagedType.LPWStr)] string extendedErrorInformation);
"@
$api = Add-Type -MemberDefinition $sig -Name 'WsmSvc_WSManPluginAuthzOperationComplete' -Namespace Win32 -PassThru
# $api::WSManPluginAuthzOperationComplete(senderDetails, flags, userAuthorizationContext, errorCode, extendedErrorInformation)
#uselib "WsmSvc.dll"
#func global WSManPluginAuthzOperationComplete "WSManPluginAuthzOperationComplete" sptr, sptr, sptr, sptr, sptr
; WSManPluginAuthzOperationComplete varptr(senderDetails), flags, userAuthorizationContext, errorCode, extendedErrorInformation   ; 戻り値は stat
; senderDetails : WSMAN_SENDER_DETAILS* -> "sptr"
; flags : DWORD -> "sptr"
; userAuthorizationContext : void* optional -> "sptr"
; errorCode : DWORD -> "sptr"
; extendedErrorInformation : LPCWSTR optional -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "WsmSvc.dll"
#cfunc global WSManPluginAuthzOperationComplete "WSManPluginAuthzOperationComplete" var, int, sptr, int, wstr
; res = WSManPluginAuthzOperationComplete(senderDetails, flags, userAuthorizationContext, errorCode, extendedErrorInformation)
; senderDetails : WSMAN_SENDER_DETAILS* -> "var"
; flags : DWORD -> "int"
; userAuthorizationContext : void* optional -> "sptr"
; errorCode : DWORD -> "int"
; extendedErrorInformation : LPCWSTR optional -> "wstr"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; DWORD WSManPluginAuthzOperationComplete(WSMAN_SENDER_DETAILS* senderDetails, DWORD flags, void* userAuthorizationContext, DWORD errorCode, LPCWSTR extendedErrorInformation)
#uselib "WsmSvc.dll"
#cfunc global WSManPluginAuthzOperationComplete "WSManPluginAuthzOperationComplete" var, int, intptr, int, wstr
; res = WSManPluginAuthzOperationComplete(senderDetails, flags, userAuthorizationContext, errorCode, extendedErrorInformation)
; senderDetails : WSMAN_SENDER_DETAILS* -> "var"
; flags : DWORD -> "int"
; userAuthorizationContext : void* optional -> "intptr"
; errorCode : DWORD -> "int"
; extendedErrorInformation : LPCWSTR optional -> "wstr"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	wsmsvc = windows.NewLazySystemDLL("WsmSvc.dll")
	procWSManPluginAuthzOperationComplete = wsmsvc.NewProc("WSManPluginAuthzOperationComplete")
)

// senderDetails (WSMAN_SENDER_DETAILS*), flags (DWORD), userAuthorizationContext (void* optional), errorCode (DWORD), extendedErrorInformation (LPCWSTR optional)
r1, _, err := procWSManPluginAuthzOperationComplete.Call(
	uintptr(senderDetails),
	uintptr(flags),
	uintptr(userAuthorizationContext),
	uintptr(errorCode),
	uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(extendedErrorInformation))),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // DWORD
function WSManPluginAuthzOperationComplete(
  senderDetails: Pointer;   // WSMAN_SENDER_DETAILS*
  flags: DWORD;   // DWORD
  userAuthorizationContext: Pointer;   // void* optional
  errorCode: DWORD;   // DWORD
  extendedErrorInformation: PWideChar   // LPCWSTR optional
): DWORD; stdcall;
  external 'WsmSvc.dll' name 'WSManPluginAuthzOperationComplete';
result := DllCall("WsmSvc\WSManPluginAuthzOperationComplete"
    , "Ptr", senderDetails   ; WSMAN_SENDER_DETAILS*
    , "UInt", flags   ; DWORD
    , "Ptr", userAuthorizationContext   ; void* optional
    , "UInt", errorCode   ; DWORD
    , "WStr", extendedErrorInformation   ; LPCWSTR optional
    , "UInt")   ; return: DWORD
●WSManPluginAuthzOperationComplete(senderDetails, flags, userAuthorizationContext, errorCode, extendedErrorInformation) = DLL("WsmSvc.dll", "dword WSManPluginAuthzOperationComplete(void*, dword, void*, dword, char*)")
# 呼び出し: WSManPluginAuthzOperationComplete(senderDetails, flags, userAuthorizationContext, errorCode, extendedErrorInformation)
# senderDetails : WSMAN_SENDER_DETAILS* -> "void*"
# flags : DWORD -> "dword"
# userAuthorizationContext : void* optional -> "void*"
# errorCode : DWORD -> "dword"
# extendedErrorInformation : LPCWSTR optional -> "char*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
const std = @import("std");

extern "wsmsvc" fn WSManPluginAuthzOperationComplete(
    senderDetails: [*c]WSMAN_SENDER_DETAILS, // WSMAN_SENDER_DETAILS*
    flags: u32, // DWORD
    userAuthorizationContext: ?*anyopaque, // void* optional
    errorCode: u32, // DWORD
    extendedErrorInformation: [*c]const u16 // LPCWSTR optional
) callconv(std.os.windows.WINAPI) u32;
proc WSManPluginAuthzOperationComplete(
    senderDetails: ptr WSMAN_SENDER_DETAILS,  # WSMAN_SENDER_DETAILS*
    flags: uint32,  # DWORD
    userAuthorizationContext: pointer,  # void* optional
    errorCode: uint32,  # DWORD
    extendedErrorInformation: WideCString  # LPCWSTR optional
): uint32 {.importc: "WSManPluginAuthzOperationComplete", stdcall, dynlib: "WsmSvc.dll".}
pragma(lib, "wsmsvc");
extern(Windows)
uint WSManPluginAuthzOperationComplete(
    WSMAN_SENDER_DETAILS* senderDetails,   // WSMAN_SENDER_DETAILS*
    uint flags,   // DWORD
    void* userAuthorizationContext,   // void* optional
    uint errorCode,   // DWORD
    const(wchar)* extendedErrorInformation   // LPCWSTR optional
);
ccall((:WSManPluginAuthzOperationComplete, "WsmSvc.dll"), stdcall, UInt32,
      (Ptr{WSMAN_SENDER_DETAILS}, UInt32, Ptr{Cvoid}, UInt32, Cwstring),
      senderDetails, flags, userAuthorizationContext, errorCode, extendedErrorInformation)
# senderDetails : WSMAN_SENDER_DETAILS* -> Ptr{WSMAN_SENDER_DETAILS}
# flags : DWORD -> UInt32
# userAuthorizationContext : void* optional -> Ptr{Cvoid}
# errorCode : DWORD -> UInt32
# extendedErrorInformation : LPCWSTR optional -> Cwstring
# stdcall は 32bit のみ意味を持つ(x64 では無視)。
local ffi = require("ffi")
ffi.cdef[[
uint32_t WSManPluginAuthzOperationComplete(
    void* senderDetails,
    uint32_t flags,
    void* userAuthorizationContext,
    uint32_t errorCode,
    const uint16_t* extendedErrorInformation);
]]
local wsmsvc = ffi.load("wsmsvc")
-- wsmsvc.WSManPluginAuthzOperationComplete(senderDetails, flags, userAuthorizationContext, errorCode, extendedErrorInformation)
-- senderDetails : WSMAN_SENDER_DETAILS*
-- flags : DWORD
-- userAuthorizationContext : void* optional
-- errorCode : DWORD
-- extendedErrorInformation : LPCWSTR optional
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
const koffi = require('koffi');
const lib = koffi.load('WsmSvc.dll');
const WSManPluginAuthzOperationComplete = lib.func('__stdcall', 'WSManPluginAuthzOperationComplete', 'uint32_t', ['void *', 'uint32_t', 'void *', 'uint32_t', 'str16']);
// WSManPluginAuthzOperationComplete(senderDetails, flags, userAuthorizationContext, errorCode, extendedErrorInformation)
// senderDetails : WSMAN_SENDER_DETAILS* -> 'void *'
// flags : DWORD -> 'uint32_t'
// userAuthorizationContext : void* optional -> 'void *'
// errorCode : DWORD -> 'uint32_t'
// extendedErrorInformation : LPCWSTR optional -> 'str16'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
const lib = Deno.dlopen("WsmSvc.dll", {
  WSManPluginAuthzOperationComplete: { parameters: ["pointer", "u32", "pointer", "u32", "buffer"], result: "u32" },
});
// lib.symbols.WSManPluginAuthzOperationComplete(senderDetails, flags, userAuthorizationContext, errorCode, extendedErrorInformation)
// senderDetails : WSMAN_SENDER_DETAILS* -> "pointer"
// flags : DWORD -> "u32"
// userAuthorizationContext : void* optional -> "pointer"
// errorCode : DWORD -> "u32"
// extendedErrorInformation : LPCWSTR optional -> "buffer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。
<?php
$ffi = FFI::cdef(<<<C
uint32_t WSManPluginAuthzOperationComplete(
    void* senderDetails,
    uint32_t flags,
    void* userAuthorizationContext,
    uint32_t errorCode,
    const uint16_t* extendedErrorInformation);
C, "WsmSvc.dll");
// $ffi->WSManPluginAuthzOperationComplete(senderDetails, flags, userAuthorizationContext, errorCode, extendedErrorInformation);
// senderDetails : WSMAN_SENDER_DETAILS*
// flags : DWORD
// userAuthorizationContext : void* optional
// errorCode : DWORD
// extendedErrorInformation : LPCWSTR optional
// 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
// WINAPI(stdcall): x64 では呼出規約が統一されるため問題なし。x86 では __stdcall 対応のラッパが必要な場合あり。
import com.sun.jna.*;
import com.sun.jna.ptr.*;
import com.sun.jna.win32.StdCallLibrary;
import com.sun.jna.win32.W32APIOptions;

public interface Wsmsvc extends StdCallLibrary {
    Wsmsvc INSTANCE = Native.load("wsmsvc", Wsmsvc.class);
    int WSManPluginAuthzOperationComplete(
        Pointer senderDetails,   // WSMAN_SENDER_DETAILS*
        int flags,   // DWORD
        Pointer userAuthorizationContext,   // void* optional
        int errorCode,   // DWORD
        WString extendedErrorInformation   // LPCWSTR optional
    );
}
@[Link("wsmsvc")]
lib LibWsmSvc
  fun WSManPluginAuthzOperationComplete = WSManPluginAuthzOperationComplete(
    senderDetails : WSMAN_SENDER_DETAILS*,   # WSMAN_SENDER_DETAILS*
    flags : UInt32,   # DWORD
    userAuthorizationContext : Void*,   # void* optional
    errorCode : UInt32,   # DWORD
    extendedErrorInformation : UInt16*   # LPCWSTR optional
  ) : UInt32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。
import 'dart:ffi';
import 'package:ffi/ffi.dart';

typedef WSManPluginAuthzOperationCompleteNative = Uint32 Function(Pointer<Void>, Uint32, Pointer<Void>, Uint32, Pointer<Utf16>);
typedef WSManPluginAuthzOperationCompleteDart = int Function(Pointer<Void>, int, Pointer<Void>, int, Pointer<Utf16>);
final WSManPluginAuthzOperationComplete = DynamicLibrary.open('WsmSvc.dll')
    .lookupFunction<WSManPluginAuthzOperationCompleteNative, WSManPluginAuthzOperationCompleteDart>('WSManPluginAuthzOperationComplete');
// senderDetails : WSMAN_SENDER_DETAILS* -> Pointer<Void>
// flags : DWORD -> Uint32
// userAuthorizationContext : void* optional -> Pointer<Void>
// errorCode : DWORD -> Uint32
// extendedErrorInformation : LPCWSTR optional -> Pointer<Utf16>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
function WSManPluginAuthzOperationComplete(
  senderDetails: Pointer;   // WSMAN_SENDER_DETAILS*
  flags: DWORD;   // DWORD
  userAuthorizationContext: Pointer;   // void* optional
  errorCode: DWORD;   // DWORD
  extendedErrorInformation: PWideChar   // LPCWSTR optional
): DWORD; stdcall;
  external 'WsmSvc.dll' name 'WSManPluginAuthzOperationComplete';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import stdcall safe "WSManPluginAuthzOperationComplete"
  c_WSManPluginAuthzOperationComplete :: Ptr () -> Word32 -> Ptr () -> Word32 -> CWString -> IO Word32
-- senderDetails : WSMAN_SENDER_DETAILS* -> Ptr ()
-- flags : DWORD -> Word32
-- userAuthorizationContext : void* optional -> Ptr ()
-- errorCode : DWORD -> Word32
-- extendedErrorInformation : LPCWSTR optional -> CWString
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let wsmanpluginauthzoperationcomplete =
  foreign "WSManPluginAuthzOperationComplete"
    ((ptr void) @-> uint32_t @-> (ptr void) @-> uint32_t @-> (ptr uint16_t) @-> returning uint32_t)
(* senderDetails : WSMAN_SENDER_DETAILS* -> (ptr void) *)
(* flags : DWORD -> uint32_t *)
(* userAuthorizationContext : void* optional -> (ptr void) *)
(* errorCode : DWORD -> uint32_t *)
(* extendedErrorInformation : LPCWSTR optional -> (ptr uint16_t) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)
(cffi:define-foreign-library wsmsvc (t "WsmSvc.dll"))
(cffi:use-foreign-library wsmsvc)

(cffi:defcfun ("WSManPluginAuthzOperationComplete" wsman-plugin-authz-operation-complete :convention :stdcall) :uint32
  (sender-details :pointer)   ; WSMAN_SENDER_DETAILS*
  (flags :uint32)   ; DWORD
  (user-authorization-context :pointer)   ; void* optional
  (error-code :uint32)   ; DWORD
  (extended-error-information (:string :encoding :utf-16le)))   ; LPCWSTR optional
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $WSManPluginAuthzOperationComplete = Win32::API::More->new('WsmSvc',
    'DWORD WSManPluginAuthzOperationComplete(LPVOID senderDetails, DWORD flags, LPVOID userAuthorizationContext, DWORD errorCode, LPCWSTR extendedErrorInformation)');
# my $ret = $WSManPluginAuthzOperationComplete->Call($senderDetails, $flags, $userAuthorizationContext, $errorCode, $extendedErrorInformation);
# senderDetails : WSMAN_SENDER_DETAILS* -> LPVOID
# flags : DWORD -> DWORD
# userAuthorizationContext : void* optional -> LPVOID
# errorCode : DWORD -> DWORD
# extendedErrorInformation : LPCWSTR optional -> LPCWSTR
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。

関連項目

使用する型