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

RasGetEapUserIdentityA

関数
EAP認証で使用するユーザーIDを取得する(ANSI版)。
DLLRASAPI32.dll文字セットANSI (-A)呼出規約winapi対応OSWindows 2000 以降

シグネチャ

// RASAPI32.dll  (ANSI / -A)
#include <windows.h>

DWORD RasGetEapUserIdentityA(
    LPCSTR pszPhonebook,   // optional
    LPCSTR pszEntry,
    DWORD dwFlags,
    HWND hwnd,
    RASEAPUSERIDENTITYA** ppRasEapUserIdentity
);

パラメーター

名前方向
pszPhonebookLPCSTRinoptional
pszEntryLPCSTRin
dwFlagsDWORDin
hwndHWNDin
ppRasEapUserIdentityRASEAPUSERIDENTITYA**out

戻り値の型: DWORD

各言語での呼び出し定義

// RASAPI32.dll  (ANSI / -A)
#include <windows.h>

DWORD RasGetEapUserIdentityA(
    LPCSTR pszPhonebook,   // optional
    LPCSTR pszEntry,
    DWORD dwFlags,
    HWND hwnd,
    RASEAPUSERIDENTITYA** ppRasEapUserIdentity
);
[DllImport("RASAPI32.dll", CharSet = CharSet.Ansi, ExactSpelling = true)]
static extern uint RasGetEapUserIdentityA(
    [MarshalAs(UnmanagedType.LPStr)] string pszPhonebook,   // LPCSTR optional
    [MarshalAs(UnmanagedType.LPStr)] string pszEntry,   // LPCSTR
    uint dwFlags,   // DWORD
    IntPtr hwnd,   // HWND
    IntPtr ppRasEapUserIdentity   // RASEAPUSERIDENTITYA** out
);
<DllImport("RASAPI32.dll", CharSet:=CharSet.Ansi, ExactSpelling:=True)>
Public Shared Function RasGetEapUserIdentityA(
    <MarshalAs(UnmanagedType.LPStr)> pszPhonebook As String,   ' LPCSTR optional
    <MarshalAs(UnmanagedType.LPStr)> pszEntry As String,   ' LPCSTR
    dwFlags As UInteger,   ' DWORD
    hwnd As IntPtr,   ' HWND
    ppRasEapUserIdentity As IntPtr   ' RASEAPUSERIDENTITYA** out
) As UInteger
End Function
' pszPhonebook : LPCSTR optional
' pszEntry : LPCSTR
' dwFlags : DWORD
' hwnd : HWND
' ppRasEapUserIdentity : RASEAPUSERIDENTITYA** out
Declare PtrSafe Function RasGetEapUserIdentityA Lib "rasapi32" ( _
    ByVal pszPhonebook As String, _
    ByVal pszEntry As String, _
    ByVal dwFlags As Long, _
    ByVal hwnd As LongPtr, _
    ByVal ppRasEapUserIdentity As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

RasGetEapUserIdentityA = ctypes.windll.rasapi32.RasGetEapUserIdentityA
RasGetEapUserIdentityA.restype = wintypes.DWORD
RasGetEapUserIdentityA.argtypes = [
    wintypes.LPCSTR,  # pszPhonebook : LPCSTR optional
    wintypes.LPCSTR,  # pszEntry : LPCSTR
    wintypes.DWORD,  # dwFlags : DWORD
    wintypes.HANDLE,  # hwnd : HWND
    ctypes.c_void_p,  # ppRasEapUserIdentity : RASEAPUSERIDENTITYA** out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('RASAPI32.dll')
RasGetEapUserIdentityA = Fiddle::Function.new(
  lib['RasGetEapUserIdentityA'],
  [
    Fiddle::TYPE_VOIDP,  # pszPhonebook : LPCSTR optional
    Fiddle::TYPE_VOIDP,  # pszEntry : LPCSTR
    -Fiddle::TYPE_INT,  # dwFlags : DWORD
    Fiddle::TYPE_VOIDP,  # hwnd : HWND
    Fiddle::TYPE_VOIDP,  # ppRasEapUserIdentity : RASEAPUSERIDENTITYA** out
  ],
  -Fiddle::TYPE_INT)
#[link(name = "rasapi32")]
extern "system" {
    fn RasGetEapUserIdentityA(
        pszPhonebook: *const u8,  // LPCSTR optional
        pszEntry: *const u8,  // LPCSTR
        dwFlags: u32,  // DWORD
        hwnd: *mut core::ffi::c_void,  // HWND
        ppRasEapUserIdentity: *mut *mut RASEAPUSERIDENTITYA  // RASEAPUSERIDENTITYA** out
    ) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("RASAPI32.dll", CharSet = CharSet.Ansi)]
public static extern uint RasGetEapUserIdentityA([MarshalAs(UnmanagedType.LPStr)] string pszPhonebook, [MarshalAs(UnmanagedType.LPStr)] string pszEntry, uint dwFlags, IntPtr hwnd, IntPtr ppRasEapUserIdentity);
"@
$api = Add-Type -MemberDefinition $sig -Name 'RASAPI32_RasGetEapUserIdentityA' -Namespace Win32 -PassThru
# $api::RasGetEapUserIdentityA(pszPhonebook, pszEntry, dwFlags, hwnd, ppRasEapUserIdentity)
#uselib "RASAPI32.dll"
#func global RasGetEapUserIdentityA "RasGetEapUserIdentityA" sptr, sptr, sptr, sptr, sptr
; RasGetEapUserIdentityA pszPhonebook, pszEntry, dwFlags, hwnd, varptr(ppRasEapUserIdentity)   ; 戻り値は stat
; pszPhonebook : LPCSTR optional -> "sptr"
; pszEntry : LPCSTR -> "sptr"
; dwFlags : DWORD -> "sptr"
; hwnd : HWND -> "sptr"
; ppRasEapUserIdentity : RASEAPUSERIDENTITYA** out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "RASAPI32.dll"
#cfunc global RasGetEapUserIdentityA "RasGetEapUserIdentityA" str, str, int, sptr, var
; res = RasGetEapUserIdentityA(pszPhonebook, pszEntry, dwFlags, hwnd, ppRasEapUserIdentity)
; pszPhonebook : LPCSTR optional -> "str"
; pszEntry : LPCSTR -> "str"
; dwFlags : DWORD -> "int"
; hwnd : HWND -> "sptr"
; ppRasEapUserIdentity : RASEAPUSERIDENTITYA** out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; DWORD RasGetEapUserIdentityA(LPCSTR pszPhonebook, LPCSTR pszEntry, DWORD dwFlags, HWND hwnd, RASEAPUSERIDENTITYA** ppRasEapUserIdentity)
#uselib "RASAPI32.dll"
#cfunc global RasGetEapUserIdentityA "RasGetEapUserIdentityA" str, str, int, intptr, var
; res = RasGetEapUserIdentityA(pszPhonebook, pszEntry, dwFlags, hwnd, ppRasEapUserIdentity)
; pszPhonebook : LPCSTR optional -> "str"
; pszEntry : LPCSTR -> "str"
; dwFlags : DWORD -> "int"
; hwnd : HWND -> "intptr"
; ppRasEapUserIdentity : RASEAPUSERIDENTITYA** out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	rasapi32 = windows.NewLazySystemDLL("RASAPI32.dll")
	procRasGetEapUserIdentityA = rasapi32.NewProc("RasGetEapUserIdentityA")
)

// pszPhonebook (LPCSTR optional), pszEntry (LPCSTR), dwFlags (DWORD), hwnd (HWND), ppRasEapUserIdentity (RASEAPUSERIDENTITYA** out)
r1, _, err := procRasGetEapUserIdentityA.Call(
	uintptr(unsafe.Pointer(windows.BytePtrFromString(pszPhonebook))),
	uintptr(unsafe.Pointer(windows.BytePtrFromString(pszEntry))),
	uintptr(dwFlags),
	uintptr(hwnd),
	uintptr(ppRasEapUserIdentity),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // DWORD
function RasGetEapUserIdentityA(
  pszPhonebook: PAnsiChar;   // LPCSTR optional
  pszEntry: PAnsiChar;   // LPCSTR
  dwFlags: DWORD;   // DWORD
  hwnd: THandle;   // HWND
  ppRasEapUserIdentity: Pointer   // RASEAPUSERIDENTITYA** out
): DWORD; stdcall;
  external 'RASAPI32.dll' name 'RasGetEapUserIdentityA';
result := DllCall("RASAPI32\RasGetEapUserIdentityA"
    , "AStr", pszPhonebook   ; LPCSTR optional
    , "AStr", pszEntry   ; LPCSTR
    , "UInt", dwFlags   ; DWORD
    , "Ptr", hwnd   ; HWND
    , "Ptr", ppRasEapUserIdentity   ; RASEAPUSERIDENTITYA** out
    , "UInt")   ; return: DWORD
●RasGetEapUserIdentityA(pszPhonebook, pszEntry, dwFlags, hwnd, ppRasEapUserIdentity) = DLL("RASAPI32.dll", "dword RasGetEapUserIdentityA(char*, char*, dword, void*, void*)")
# 呼び出し: RasGetEapUserIdentityA(pszPhonebook, pszEntry, dwFlags, hwnd, ppRasEapUserIdentity)
# pszPhonebook : LPCSTR optional -> "char*"
# pszEntry : LPCSTR -> "char*"
# dwFlags : DWORD -> "dword"
# hwnd : HWND -> "void*"
# ppRasEapUserIdentity : RASEAPUSERIDENTITYA** out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。