Win32 API 日本語リファレンス
ホーム › NetworkManagement.Rras › MprAdminConnectionRemoveQuarantine

MprAdminConnectionRemoveQuarantine

関数
RAS接続の検疫(隔離)状態を解除する。
DLLMPRAPI.dll呼出規約winapi対応OSWindows Vista 以降

シグネチャ

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

DWORD MprAdminConnectionRemoveQuarantine(
    HANDLE hRasServer,
    HANDLE hRasConnection,
    BOOL fIsIpAddress
);

パラメーター

名前型方向説明
hRasServerHANDLEin接続を処理する RAS サーバーへのハンドル。このハンドルは MprAdminServerConnect を呼び出して取得します。
hRasConnectionHANDLEin

検疫フィルターを削除する対象の RAS クライアントの接続へのハンドル。このハンドルは MprAdminConnectionEnum を呼び出して取得します。

あるいは、このパラメーターには、検疫フィルターを削除する対象の RAS クライアントの IP アドレスを指定します。IP アドレスは、ネットワーク バイト オーダーの DWORD として指定する必要があります。IP アドレスは MprAdminConnectionEnum を呼び出して取得します。このパラメーターに IP アドレスを指定する場合、fIsIpAddress パラメーターには TRUE を指定する必要があります。

fIsIpAddressBOOLinhRasConnection パラメーターが、検疫フィルターを削除する対象のクライアントの IP アドレスを指定しているかどうかを示すブール値を指定します。このパラメーターが TRUE の場合、hRasConnection は IP アドレスを指定します。それ以外の場合、hRasConnection は接続へのハンドルを指定します。

戻り値の型: DWORD

公式ドキュメント

MprAdminConnectionRemoveQuarantine 関数は、ダイヤルインした RAS クライアントに適用されている検疫フィルターが Internet Authentication Service (IAS) ポリシーの結果として適用されたものである場合に、そのフィルターを削除します。

戻り値

関数が成功した場合、戻り値は NO_ERROR です。

関数が失敗した場合、戻り値は次のいずれかのエラー コードです。

戻り値 説明
ERROR_INVALID_PARAMETER
RAS サーバーへのハンドル、または RAS 接続へのハンドルが無効です。
ERROR_NOT_FOUND
RAS クライアントは検疫されていません。
その他
MprError.h、RasError.h、または WinError.h のエラーです。

解説(Remarks)

Internet Authentication Service (IAS) のポリシーで通常のフィルターが構成されている場合、 MprAdminConnectionRemoveQuarantine を呼び出した結果として、これらのフィルターが RAS クライアント インターフェイスに追加されます。

出典・ライセンス: 上記「公式ドキュメント」の内容は Microsoft の Win32 API ドキュメント(MicrosoftDocs/sdk-api)を日本語に翻訳・改変したものです。© Microsoft Corporation. CC BY 4.0 で提供。
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)

各言語での呼び出し定義

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

DWORD MprAdminConnectionRemoveQuarantine(
    HANDLE hRasServer,
    HANDLE hRasConnection,
    BOOL fIsIpAddress
);
[DllImport("MPRAPI.dll", ExactSpelling = true)]
static extern uint MprAdminConnectionRemoveQuarantine(
    IntPtr hRasServer,   // HANDLE
    IntPtr hRasConnection,   // HANDLE
    bool fIsIpAddress   // BOOL
);
<DllImport("MPRAPI.dll", ExactSpelling:=True)>
Public Shared Function MprAdminConnectionRemoveQuarantine(
    hRasServer As IntPtr,   ' HANDLE
    hRasConnection As IntPtr,   ' HANDLE
    fIsIpAddress As Boolean   ' BOOL
) As UInteger
End Function
' hRasServer : HANDLE
' hRasConnection : HANDLE
' fIsIpAddress : BOOL
Declare PtrSafe Function MprAdminConnectionRemoveQuarantine Lib "mprapi" ( _
    ByVal hRasServer As LongPtr, _
    ByVal hRasConnection As LongPtr, _
    ByVal fIsIpAddress As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

MprAdminConnectionRemoveQuarantine = ctypes.windll.mprapi.MprAdminConnectionRemoveQuarantine
MprAdminConnectionRemoveQuarantine.restype = wintypes.DWORD
MprAdminConnectionRemoveQuarantine.argtypes = [
    wintypes.HANDLE,  # hRasServer : HANDLE
    wintypes.HANDLE,  # hRasConnection : HANDLE
    wintypes.BOOL,  # fIsIpAddress : BOOL
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('MPRAPI.dll')
MprAdminConnectionRemoveQuarantine = Fiddle::Function.new(
  lib['MprAdminConnectionRemoveQuarantine'],
  [
    Fiddle::TYPE_VOIDP,  # hRasServer : HANDLE
    Fiddle::TYPE_VOIDP,  # hRasConnection : HANDLE
    Fiddle::TYPE_INT,  # fIsIpAddress : BOOL
  ],
  -Fiddle::TYPE_INT)
#[link(name = "mprapi")]
extern "system" {
    fn MprAdminConnectionRemoveQuarantine(
        hRasServer: *mut core::ffi::c_void,  // HANDLE
        hRasConnection: *mut core::ffi::c_void,  // HANDLE
        fIsIpAddress: i32  // BOOL
    ) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("MPRAPI.dll")]
public static extern uint MprAdminConnectionRemoveQuarantine(IntPtr hRasServer, IntPtr hRasConnection, bool fIsIpAddress);
"@
$api = Add-Type -MemberDefinition $sig -Name 'MPRAPI_MprAdminConnectionRemoveQuarantine' -Namespace Win32 -PassThru
# $api::MprAdminConnectionRemoveQuarantine(hRasServer, hRasConnection, fIsIpAddress)
#uselib "MPRAPI.dll"
#func global MprAdminConnectionRemoveQuarantine "MprAdminConnectionRemoveQuarantine" sptr, sptr, sptr
; MprAdminConnectionRemoveQuarantine hRasServer, hRasConnection, fIsIpAddress   ; 戻り値は stat
; hRasServer : HANDLE -> "sptr"
; hRasConnection : HANDLE -> "sptr"
; fIsIpAddress : BOOL -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "MPRAPI.dll"
#cfunc global MprAdminConnectionRemoveQuarantine "MprAdminConnectionRemoveQuarantine" sptr, sptr, int
; res = MprAdminConnectionRemoveQuarantine(hRasServer, hRasConnection, fIsIpAddress)
; hRasServer : HANDLE -> "sptr"
; hRasConnection : HANDLE -> "sptr"
; fIsIpAddress : BOOL -> "int"
; DWORD MprAdminConnectionRemoveQuarantine(HANDLE hRasServer, HANDLE hRasConnection, BOOL fIsIpAddress)
#uselib "MPRAPI.dll"
#cfunc global MprAdminConnectionRemoveQuarantine "MprAdminConnectionRemoveQuarantine" intptr, intptr, int
; res = MprAdminConnectionRemoveQuarantine(hRasServer, hRasConnection, fIsIpAddress)
; hRasServer : HANDLE -> "intptr"
; hRasConnection : HANDLE -> "intptr"
; fIsIpAddress : BOOL -> "int"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	mprapi = windows.NewLazySystemDLL("MPRAPI.dll")
	procMprAdminConnectionRemoveQuarantine = mprapi.NewProc("MprAdminConnectionRemoveQuarantine")
)

// hRasServer (HANDLE), hRasConnection (HANDLE), fIsIpAddress (BOOL)
r1, _, err := procMprAdminConnectionRemoveQuarantine.Call(
	uintptr(hRasServer),
	uintptr(hRasConnection),
	uintptr(fIsIpAddress),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // DWORD
function MprAdminConnectionRemoveQuarantine(
  hRasServer: THandle;   // HANDLE
  hRasConnection: THandle;   // HANDLE
  fIsIpAddress: BOOL   // BOOL
): DWORD; stdcall;
  external 'MPRAPI.dll' name 'MprAdminConnectionRemoveQuarantine';
result := DllCall("MPRAPI\MprAdminConnectionRemoveQuarantine"
    , "Ptr", hRasServer   ; HANDLE
    , "Ptr", hRasConnection   ; HANDLE
    , "Int", fIsIpAddress   ; BOOL
    , "UInt")   ; return: DWORD
●MprAdminConnectionRemoveQuarantine(hRasServer, hRasConnection, fIsIpAddress) = DLL("MPRAPI.dll", "dword MprAdminConnectionRemoveQuarantine(void*, void*, bool)")
# 呼び出し: MprAdminConnectionRemoveQuarantine(hRasServer, hRasConnection, fIsIpAddress)
# hRasServer : HANDLE -> "void*"
# hRasConnection : HANDLE -> "void*"
# fIsIpAddress : BOOL -> "bool"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
const std = @import("std");

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

typedef MprAdminConnectionRemoveQuarantineNative = Uint32 Function(Pointer<Void>, Pointer<Void>, Int32);
typedef MprAdminConnectionRemoveQuarantineDart = int Function(Pointer<Void>, Pointer<Void>, int);
final MprAdminConnectionRemoveQuarantine = DynamicLibrary.open('MPRAPI.dll')
    .lookupFunction<MprAdminConnectionRemoveQuarantineNative, MprAdminConnectionRemoveQuarantineDart>('MprAdminConnectionRemoveQuarantine');
// hRasServer : HANDLE -> Pointer<Void>
// hRasConnection : HANDLE -> Pointer<Void>
// fIsIpAddress : BOOL -> Int32
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
function MprAdminConnectionRemoveQuarantine(
  hRasServer: THandle;   // HANDLE
  hRasConnection: THandle;   // HANDLE
  fIsIpAddress: BOOL   // BOOL
): DWORD; stdcall;
  external 'MPRAPI.dll' name 'MprAdminConnectionRemoveQuarantine';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import stdcall safe "MprAdminConnectionRemoveQuarantine"
  c_MprAdminConnectionRemoveQuarantine :: Ptr () -> Ptr () -> CInt -> IO Word32
-- hRasServer : HANDLE -> Ptr ()
-- hRasConnection : HANDLE -> Ptr ()
-- fIsIpAddress : BOOL -> CInt
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let mpradminconnectionremovequarantine =
  foreign "MprAdminConnectionRemoveQuarantine"
    ((ptr void) @-> (ptr void) @-> int32_t @-> returning uint32_t)
(* hRasServer : HANDLE -> (ptr void) *)
(* hRasConnection : HANDLE -> (ptr void) *)
(* fIsIpAddress : BOOL -> int32_t *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)
(cffi:define-foreign-library mprapi (t "MPRAPI.dll"))
(cffi:use-foreign-library mprapi)

(cffi:defcfun ("MprAdminConnectionRemoveQuarantine" mpr-admin-connection-remove-quarantine :convention :stdcall) :uint32
  (h-ras-server :pointer)   ; HANDLE
  (h-ras-connection :pointer)   ; HANDLE
  (f-is-ip-address :int32))   ; BOOL
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $MprAdminConnectionRemoveQuarantine = Win32::API::More->new('MPRAPI',
    'DWORD MprAdminConnectionRemoveQuarantine(HANDLE hRasServer, HANDLE hRasConnection, BOOL fIsIpAddress)');
# my $ret = $MprAdminConnectionRemoveQuarantine->Call($hRasServer, $hRasConnection, $fIsIpAddress);
# hRasServer : HANDLE -> HANDLE
# hRasConnection : HANDLE -> HANDLE
# fIsIpAddress : BOOL -> BOOL
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。

関連項目

公式の関連項目