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

RasGetEapUserIdentityW

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

シグネチャ

// RASAPI32.dll  (Unicode / -W)
#include <windows.h>

DWORD RasGetEapUserIdentityW(
    LPCWSTR pszPhonebook,   // optional
    LPCWSTR pszEntry,
    DWORD dwFlags,
    HWND hwnd,
    RASEAPUSERIDENTITYW** ppRasEapUserIdentity
);

パラメーター

名前方向
pszPhonebookLPCWSTRinoptional
pszEntryLPCWSTRin
dwFlagsDWORDin
hwndHWNDin
ppRasEapUserIdentityRASEAPUSERIDENTITYW**out

戻り値の型: DWORD

各言語での呼び出し定義

// RASAPI32.dll  (Unicode / -W)
#include <windows.h>

DWORD RasGetEapUserIdentityW(
    LPCWSTR pszPhonebook,   // optional
    LPCWSTR pszEntry,
    DWORD dwFlags,
    HWND hwnd,
    RASEAPUSERIDENTITYW** ppRasEapUserIdentity
);
[DllImport("RASAPI32.dll", CharSet = CharSet.Unicode, ExactSpelling = true)]
static extern uint RasGetEapUserIdentityW(
    [MarshalAs(UnmanagedType.LPWStr)] string pszPhonebook,   // LPCWSTR optional
    [MarshalAs(UnmanagedType.LPWStr)] string pszEntry,   // LPCWSTR
    uint dwFlags,   // DWORD
    IntPtr hwnd,   // HWND
    IntPtr ppRasEapUserIdentity   // RASEAPUSERIDENTITYW** out
);
<DllImport("RASAPI32.dll", CharSet:=CharSet.Unicode, ExactSpelling:=True)>
Public Shared Function RasGetEapUserIdentityW(
    <MarshalAs(UnmanagedType.LPWStr)> pszPhonebook As String,   ' LPCWSTR optional
    <MarshalAs(UnmanagedType.LPWStr)> pszEntry As String,   ' LPCWSTR
    dwFlags As UInteger,   ' DWORD
    hwnd As IntPtr,   ' HWND
    ppRasEapUserIdentity As IntPtr   ' RASEAPUSERIDENTITYW** out
) As UInteger
End Function
' pszPhonebook : LPCWSTR optional
' pszEntry : LPCWSTR
' dwFlags : DWORD
' hwnd : HWND
' ppRasEapUserIdentity : RASEAPUSERIDENTITYW** out
Declare PtrSafe Function RasGetEapUserIdentityW Lib "rasapi32" ( _
    ByVal pszPhonebook As LongPtr, _
    ByVal pszEntry As LongPtr, _
    ByVal dwFlags As Long, _
    ByVal hwnd As LongPtr, _
    ByVal ppRasEapUserIdentity As LongPtr) As Long
' Unicode(W): 文字列は ByVal As LongPtr とし StrPtr(unicodeStr) を渡す
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

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

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

var (
	rasapi32 = windows.NewLazySystemDLL("RASAPI32.dll")
	procRasGetEapUserIdentityW = rasapi32.NewProc("RasGetEapUserIdentityW")
)

// pszPhonebook (LPCWSTR optional), pszEntry (LPCWSTR), dwFlags (DWORD), hwnd (HWND), ppRasEapUserIdentity (RASEAPUSERIDENTITYW** out)
r1, _, err := procRasGetEapUserIdentityW.Call(
	uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(pszPhonebook))),
	uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(pszEntry))),
	uintptr(dwFlags),
	uintptr(hwnd),
	uintptr(ppRasEapUserIdentity),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // DWORD
function RasGetEapUserIdentityW(
  pszPhonebook: PWideChar;   // LPCWSTR optional
  pszEntry: PWideChar;   // LPCWSTR
  dwFlags: DWORD;   // DWORD
  hwnd: THandle;   // HWND
  ppRasEapUserIdentity: Pointer   // RASEAPUSERIDENTITYW** out
): DWORD; stdcall;
  external 'RASAPI32.dll' name 'RasGetEapUserIdentityW';
result := DllCall("RASAPI32\RasGetEapUserIdentityW"
    , "WStr", pszPhonebook   ; LPCWSTR optional
    , "WStr", pszEntry   ; LPCWSTR
    , "UInt", dwFlags   ; DWORD
    , "Ptr", hwnd   ; HWND
    , "Ptr", ppRasEapUserIdentity   ; RASEAPUSERIDENTITYW** out
    , "UInt")   ; return: DWORD
●RasGetEapUserIdentityW(pszPhonebook, pszEntry, dwFlags, hwnd, ppRasEapUserIdentity) = DLL("RASAPI32.dll", "dword RasGetEapUserIdentityW(char*, char*, dword, void*, void*)")
# 呼び出し: RasGetEapUserIdentityW(pszPhonebook, pszEntry, dwFlags, hwnd, ppRasEapUserIdentity)
# pszPhonebook : LPCWSTR optional -> "char*"
# pszEntry : LPCWSTR -> "char*"
# dwFlags : DWORD -> "dword"
# hwnd : HWND -> "void*"
# ppRasEapUserIdentity : RASEAPUSERIDENTITYW** out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※-W(Unicode)関数。なでしこ1はANSIのため -A 版の利用を推奨。