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

CoQueryAuthenticationServices

関数
プロセスに登録済みの認証サービス一覧を取得する。
DLLOLE32.dll呼出規約winapi対応OSWindows 2000 以降

シグネチャ

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

HRESULT CoQueryAuthenticationServices(
    DWORD* pcAuthSvc,
    SOLE_AUTHENTICATION_SERVICE** asAuthSvc
);

パラメーター

名前方向
pcAuthSvcDWORD*out
asAuthSvcSOLE_AUTHENTICATION_SERVICE**out

戻り値の型: HRESULT

各言語での呼び出し定義

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

HRESULT CoQueryAuthenticationServices(
    DWORD* pcAuthSvc,
    SOLE_AUTHENTICATION_SERVICE** asAuthSvc
);
[DllImport("OLE32.dll", ExactSpelling = true)]
static extern int CoQueryAuthenticationServices(
    out uint pcAuthSvc,   // DWORD* out
    IntPtr asAuthSvc   // SOLE_AUTHENTICATION_SERVICE** out
);
<DllImport("OLE32.dll", ExactSpelling:=True)>
Public Shared Function CoQueryAuthenticationServices(
    <Out> ByRef pcAuthSvc As UInteger,   ' DWORD* out
    asAuthSvc As IntPtr   ' SOLE_AUTHENTICATION_SERVICE** out
) As Integer
End Function
' pcAuthSvc : DWORD* out
' asAuthSvc : SOLE_AUTHENTICATION_SERVICE** out
Declare PtrSafe Function CoQueryAuthenticationServices Lib "ole32" ( _
    ByRef pcAuthSvc As Long, _
    ByVal asAuthSvc As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

CoQueryAuthenticationServices = ctypes.windll.ole32.CoQueryAuthenticationServices
CoQueryAuthenticationServices.restype = ctypes.c_int
CoQueryAuthenticationServices.argtypes = [
    ctypes.POINTER(wintypes.DWORD),  # pcAuthSvc : DWORD* out
    ctypes.c_void_p,  # asAuthSvc : SOLE_AUTHENTICATION_SERVICE** out
]
require 'fiddle'
require 'fiddle/import'

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

var (
	ole32 = windows.NewLazySystemDLL("OLE32.dll")
	procCoQueryAuthenticationServices = ole32.NewProc("CoQueryAuthenticationServices")
)

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