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

WebAuthNCancelCurrentOperation

関数
実行中のWebAuthn操作をキャンセルする。
DLLwebauthn.dll呼出規約winapi

シグネチャ

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

HRESULT WebAuthNCancelCurrentOperation(
    const GUID* pCancellationId
);

パラメーター

名前方向説明
pCancellationIdGUID*inキャンセルする操作を識別するキャンセルIDのGUIDへのポインタ。

戻り値の型: HRESULT

各言語での呼び出し定義

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

HRESULT WebAuthNCancelCurrentOperation(
    const GUID* pCancellationId
);
[DllImport("webauthn.dll", ExactSpelling = true)]
static extern int WebAuthNCancelCurrentOperation(
    ref Guid pCancellationId   // GUID*
);
<DllImport("webauthn.dll", ExactSpelling:=True)>
Public Shared Function WebAuthNCancelCurrentOperation(
    ByRef pCancellationId As Guid   ' GUID*
) As Integer
End Function
' pCancellationId : GUID*
Declare PtrSafe Function WebAuthNCancelCurrentOperation Lib "webauthn" ( _
    ByVal pCancellationId As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

WebAuthNCancelCurrentOperation = ctypes.windll.webauthn.WebAuthNCancelCurrentOperation
WebAuthNCancelCurrentOperation.restype = ctypes.c_int
WebAuthNCancelCurrentOperation.argtypes = [
    ctypes.c_void_p,  # pCancellationId : GUID*
]
require 'fiddle'
require 'fiddle/import'

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

var (
	webauthn = windows.NewLazySystemDLL("webauthn.dll")
	procWebAuthNCancelCurrentOperation = webauthn.NewProc("WebAuthNCancelCurrentOperation")
)

// pCancellationId (GUID*)
r1, _, err := procWebAuthNCancelCurrentOperation.Call(
	uintptr(pCancellationId),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // HRESULT
function WebAuthNCancelCurrentOperation(
  pCancellationId: PGUID   // GUID*
): Integer; stdcall;
  external 'webauthn.dll' name 'WebAuthNCancelCurrentOperation';
result := DllCall("webauthn\WebAuthNCancelCurrentOperation"
    , "Ptr", pCancellationId   ; GUID*
    , "Int")   ; return: HRESULT
●WebAuthNCancelCurrentOperation(pCancellationId) = DLL("webauthn.dll", "int WebAuthNCancelCurrentOperation(void*)")
# 呼び出し: WebAuthNCancelCurrentOperation(pCancellationId)
# pCancellationId : GUID* -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
const std = @import("std");

extern "webauthn" fn WebAuthNCancelCurrentOperation(
    pCancellationId: [*c]GUID // GUID*
) callconv(std.os.windows.WINAPI) i32;
proc WebAuthNCancelCurrentOperation(
    pCancellationId: ptr GUID  # GUID*
): int32 {.importc: "WebAuthNCancelCurrentOperation", stdcall, dynlib: "webauthn.dll".}
pragma(lib, "webauthn");
extern(Windows)
int WebAuthNCancelCurrentOperation(
    GUID* pCancellationId   // GUID*
);
ccall((:WebAuthNCancelCurrentOperation, "webauthn.dll"), stdcall, Int32,
      (Ptr{GUID},),
      pCancellationId)
# pCancellationId : GUID* -> Ptr{GUID}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。
local ffi = require("ffi")
ffi.cdef[[
int32_t WebAuthNCancelCurrentOperation(
    void* pCancellationId);
]]
local webauthn = ffi.load("webauthn")
-- webauthn.WebAuthNCancelCurrentOperation(pCancellationId)
-- pCancellationId : GUID*
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
const koffi = require('koffi');
const lib = koffi.load('webauthn.dll');
const WebAuthNCancelCurrentOperation = lib.func('__stdcall', 'WebAuthNCancelCurrentOperation', 'int32_t', ['void *']);
// WebAuthNCancelCurrentOperation(pCancellationId)
// pCancellationId : GUID* -> 'void *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
const lib = Deno.dlopen("webauthn.dll", {
  WebAuthNCancelCurrentOperation: { parameters: ["pointer"], result: "i32" },
});
// lib.symbols.WebAuthNCancelCurrentOperation(pCancellationId)
// pCancellationId : GUID* -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。
<?php
$ffi = FFI::cdef(<<<C
int32_t WebAuthNCancelCurrentOperation(
    void* pCancellationId);
C, "webauthn.dll");
// $ffi->WebAuthNCancelCurrentOperation(pCancellationId);
// pCancellationId : GUID*
// 構造体/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 Webauthn extends StdCallLibrary {
    Webauthn INSTANCE = Native.load("webauthn", Webauthn.class);
    int WebAuthNCancelCurrentOperation(
        Pointer pCancellationId   // GUID*
    );
}
@[Link("webauthn")]
lib Libwebauthn
  fun WebAuthNCancelCurrentOperation = WebAuthNCancelCurrentOperation(
    pCancellationId : GUID*   # GUID*
  ) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。
import 'dart:ffi';
import 'package:ffi/ffi.dart';

typedef WebAuthNCancelCurrentOperationNative = Int32 Function(Pointer<Void>);
typedef WebAuthNCancelCurrentOperationDart = int Function(Pointer<Void>);
final WebAuthNCancelCurrentOperation = DynamicLibrary.open('webauthn.dll')
    .lookupFunction<WebAuthNCancelCurrentOperationNative, WebAuthNCancelCurrentOperationDart>('WebAuthNCancelCurrentOperation');
// pCancellationId : GUID* -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
function WebAuthNCancelCurrentOperation(
  pCancellationId: PGUID   // GUID*
): Integer; stdcall;
  external 'webauthn.dll' name 'WebAuthNCancelCurrentOperation';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import stdcall safe "WebAuthNCancelCurrentOperation"
  c_WebAuthNCancelCurrentOperation :: Ptr () -> IO Int32
-- pCancellationId : GUID* -> Ptr ()
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let webauthncancelcurrentoperation =
  foreign "WebAuthNCancelCurrentOperation"
    ((ptr void) @-> returning int32_t)
(* pCancellationId : GUID* -> (ptr void) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)
(cffi:define-foreign-library webauthn (t "webauthn.dll"))
(cffi:use-foreign-library webauthn)

(cffi:defcfun ("WebAuthNCancelCurrentOperation" web-auth-ncancel-current-operation :convention :stdcall) :int32
  (p-cancellation-id :pointer))   ; GUID*
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $WebAuthNCancelCurrentOperation = Win32::API::More->new('webauthn',
    'int WebAuthNCancelCurrentOperation(LPVOID pCancellationId)');
# my $ret = $WebAuthNCancelCurrentOperation->Call($pCancellationId);
# pCancellationId : GUID* -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。