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

RasSetEntryDialParamsW

関数
RASエントリのダイヤルパラメータを設定する(Unicode版)。
DLLRASAPI32.dll文字セットUnicode (-W)呼出規約winapi対応OSWindows 2000 以降

シグネチャ

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

DWORD RasSetEntryDialParamsW(
    LPCWSTR param0,   // optional
    RASDIALPARAMSW* param1,
    BOOL param2
);

パラメーター

名前方向
param0LPCWSTRinoptional
param1RASDIALPARAMSW*in
param2BOOLin

戻り値の型: DWORD

各言語での呼び出し定義

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

DWORD RasSetEntryDialParamsW(
    LPCWSTR param0,   // optional
    RASDIALPARAMSW* param1,
    BOOL param2
);
[DllImport("RASAPI32.dll", CharSet = CharSet.Unicode, ExactSpelling = true)]
static extern uint RasSetEntryDialParamsW(
    [MarshalAs(UnmanagedType.LPWStr)] string param0,   // LPCWSTR optional
    IntPtr param1,   // RASDIALPARAMSW*
    bool param2   // BOOL
);
<DllImport("RASAPI32.dll", CharSet:=CharSet.Unicode, ExactSpelling:=True)>
Public Shared Function RasSetEntryDialParamsW(
    <MarshalAs(UnmanagedType.LPWStr)> param0 As String,   ' LPCWSTR optional
    param1 As IntPtr,   ' RASDIALPARAMSW*
    param2 As Boolean   ' BOOL
) As UInteger
End Function
' param0 : LPCWSTR optional
' param1 : RASDIALPARAMSW*
' param2 : BOOL
Declare PtrSafe Function RasSetEntryDialParamsW Lib "rasapi32" ( _
    ByVal param0 As LongPtr, _
    ByVal param1 As LongPtr, _
    ByVal param2 As Long) 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

RasSetEntryDialParamsW = ctypes.windll.rasapi32.RasSetEntryDialParamsW
RasSetEntryDialParamsW.restype = wintypes.DWORD
RasSetEntryDialParamsW.argtypes = [
    wintypes.LPCWSTR,  # param0 : LPCWSTR optional
    ctypes.c_void_p,  # param1 : RASDIALPARAMSW*
    wintypes.BOOL,  # param2 : BOOL
]
require 'fiddle'
require 'fiddle/import'

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

var (
	rasapi32 = windows.NewLazySystemDLL("RASAPI32.dll")
	procRasSetEntryDialParamsW = rasapi32.NewProc("RasSetEntryDialParamsW")
)

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