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

WscGetSecurityProviderHealth

関数
指定したセキュリティプロバイダーの健全性状態を取得する。
DLLWSCAPI.dll呼出規約winapi対応OSWindows Vista 以降

シグネチャ

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

HRESULT WscGetSecurityProviderHealth(
    DWORD Providers,
    WSC_SECURITY_PROVIDER_HEALTH* pHealth
);

パラメーター

名前方向
ProvidersDWORDin
pHealthWSC_SECURITY_PROVIDER_HEALTH*inout

戻り値の型: HRESULT

各言語での呼び出し定義

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

HRESULT WscGetSecurityProviderHealth(
    DWORD Providers,
    WSC_SECURITY_PROVIDER_HEALTH* pHealth
);
[DllImport("WSCAPI.dll", ExactSpelling = true)]
static extern int WscGetSecurityProviderHealth(
    uint Providers,   // DWORD
    ref int pHealth   // WSC_SECURITY_PROVIDER_HEALTH* in/out
);
<DllImport("WSCAPI.dll", ExactSpelling:=True)>
Public Shared Function WscGetSecurityProviderHealth(
    Providers As UInteger,   ' DWORD
    ByRef pHealth As Integer   ' WSC_SECURITY_PROVIDER_HEALTH* in/out
) As Integer
End Function
' Providers : DWORD
' pHealth : WSC_SECURITY_PROVIDER_HEALTH* in/out
Declare PtrSafe Function WscGetSecurityProviderHealth Lib "wscapi" ( _
    ByVal Providers As Long, _
    ByRef pHealth As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

WscGetSecurityProviderHealth = ctypes.windll.wscapi.WscGetSecurityProviderHealth
WscGetSecurityProviderHealth.restype = ctypes.c_int
WscGetSecurityProviderHealth.argtypes = [
    wintypes.DWORD,  # Providers : DWORD
    ctypes.c_void_p,  # pHealth : WSC_SECURITY_PROVIDER_HEALTH* in/out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('WSCAPI.dll')
WscGetSecurityProviderHealth = Fiddle::Function.new(
  lib['WscGetSecurityProviderHealth'],
  [
    -Fiddle::TYPE_INT,  # Providers : DWORD
    Fiddle::TYPE_VOIDP,  # pHealth : WSC_SECURITY_PROVIDER_HEALTH* in/out
  ],
  Fiddle::TYPE_INT)
#[link(name = "wscapi")]
extern "system" {
    fn WscGetSecurityProviderHealth(
        Providers: u32,  // DWORD
        pHealth: *mut i32  // WSC_SECURITY_PROVIDER_HEALTH* in/out
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("WSCAPI.dll")]
public static extern int WscGetSecurityProviderHealth(uint Providers, ref int pHealth);
"@
$api = Add-Type -MemberDefinition $sig -Name 'WSCAPI_WscGetSecurityProviderHealth' -Namespace Win32 -PassThru
# $api::WscGetSecurityProviderHealth(Providers, pHealth)
#uselib "WSCAPI.dll"
#func global WscGetSecurityProviderHealth "WscGetSecurityProviderHealth" sptr, sptr
; WscGetSecurityProviderHealth Providers, pHealth   ; 戻り値は stat
; Providers : DWORD -> "sptr"
; pHealth : WSC_SECURITY_PROVIDER_HEALTH* in/out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "WSCAPI.dll"
#cfunc global WscGetSecurityProviderHealth "WscGetSecurityProviderHealth" int, int
; res = WscGetSecurityProviderHealth(Providers, pHealth)
; Providers : DWORD -> "int"
; pHealth : WSC_SECURITY_PROVIDER_HEALTH* in/out -> "int"
; HRESULT WscGetSecurityProviderHealth(DWORD Providers, WSC_SECURITY_PROVIDER_HEALTH* pHealth)
#uselib "WSCAPI.dll"
#cfunc global WscGetSecurityProviderHealth "WscGetSecurityProviderHealth" int, int
; res = WscGetSecurityProviderHealth(Providers, pHealth)
; Providers : DWORD -> "int"
; pHealth : WSC_SECURITY_PROVIDER_HEALTH* in/out -> "int"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	wscapi = windows.NewLazySystemDLL("WSCAPI.dll")
	procWscGetSecurityProviderHealth = wscapi.NewProc("WscGetSecurityProviderHealth")
)

// Providers (DWORD), pHealth (WSC_SECURITY_PROVIDER_HEALTH* in/out)
r1, _, err := procWscGetSecurityProviderHealth.Call(
	uintptr(Providers),
	uintptr(pHealth),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // HRESULT
function WscGetSecurityProviderHealth(
  Providers: DWORD;   // DWORD
  pHealth: Pointer   // WSC_SECURITY_PROVIDER_HEALTH* in/out
): Integer; stdcall;
  external 'WSCAPI.dll' name 'WscGetSecurityProviderHealth';
result := DllCall("WSCAPI\WscGetSecurityProviderHealth"
    , "UInt", Providers   ; DWORD
    , "Ptr", pHealth   ; WSC_SECURITY_PROVIDER_HEALTH* in/out
    , "Int")   ; return: HRESULT
●WscGetSecurityProviderHealth(Providers, pHealth) = DLL("WSCAPI.dll", "int WscGetSecurityProviderHealth(dword, void*)")
# 呼び出し: WscGetSecurityProviderHealth(Providers, pHealth)
# Providers : DWORD -> "dword"
# pHealth : WSC_SECURITY_PROVIDER_HEALTH* in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。