ホーム › NetworkManagement.NetManagement › RouterGetErrorStringA
RouterGetErrorStringA
関数ルーターのエラーコードに対応するエラー文字列を取得する(ANSI版)。
シグネチャ
// rtutils.dll (ANSI / -A)
#include <windows.h>
DWORD RouterGetErrorStringA(
DWORD dwErrorCode,
LPSTR* lplpszErrorString
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| dwErrorCode | DWORD | in |
| lplpszErrorString | LPSTR* | out |
戻り値の型: DWORD
各言語での呼び出し定義
// rtutils.dll (ANSI / -A)
#include <windows.h>
DWORD RouterGetErrorStringA(
DWORD dwErrorCode,
LPSTR* lplpszErrorString
);[DllImport("rtutils.dll", CharSet = CharSet.Ansi, ExactSpelling = true)]
static extern uint RouterGetErrorStringA(
uint dwErrorCode, // DWORD
IntPtr lplpszErrorString // LPSTR* out
);<DllImport("rtutils.dll", CharSet:=CharSet.Ansi, ExactSpelling:=True)>
Public Shared Function RouterGetErrorStringA(
dwErrorCode As UInteger, ' DWORD
lplpszErrorString As IntPtr ' LPSTR* out
) As UInteger
End Function' dwErrorCode : DWORD
' lplpszErrorString : LPSTR* out
Declare PtrSafe Function RouterGetErrorStringA Lib "rtutils" ( _
ByVal dwErrorCode As Long, _
ByVal lplpszErrorString As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
RouterGetErrorStringA = ctypes.windll.rtutils.RouterGetErrorStringA
RouterGetErrorStringA.restype = wintypes.DWORD
RouterGetErrorStringA.argtypes = [
wintypes.DWORD, # dwErrorCode : DWORD
ctypes.c_void_p, # lplpszErrorString : LPSTR* out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('rtutils.dll')
RouterGetErrorStringA = Fiddle::Function.new(
lib['RouterGetErrorStringA'],
[
-Fiddle::TYPE_INT, # dwErrorCode : DWORD
Fiddle::TYPE_VOIDP, # lplpszErrorString : LPSTR* out
],
-Fiddle::TYPE_INT)#[link(name = "rtutils")]
extern "system" {
fn RouterGetErrorStringA(
dwErrorCode: u32, // DWORD
lplpszErrorString: *mut *mut u8 // LPSTR* out
) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("rtutils.dll", CharSet = CharSet.Ansi)]
public static extern uint RouterGetErrorStringA(uint dwErrorCode, IntPtr lplpszErrorString);
"@
$api = Add-Type -MemberDefinition $sig -Name 'rtutils_RouterGetErrorStringA' -Namespace Win32 -PassThru
# $api::RouterGetErrorStringA(dwErrorCode, lplpszErrorString)#uselib "rtutils.dll"
#func global RouterGetErrorStringA "RouterGetErrorStringA" sptr, sptr
; RouterGetErrorStringA dwErrorCode, varptr(lplpszErrorString) ; 戻り値は stat
; dwErrorCode : DWORD -> "sptr"
; lplpszErrorString : LPSTR* out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "rtutils.dll" #cfunc global RouterGetErrorStringA "RouterGetErrorStringA" int, var ; res = RouterGetErrorStringA(dwErrorCode, lplpszErrorString) ; dwErrorCode : DWORD -> "int" ; lplpszErrorString : LPSTR* out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "rtutils.dll" #cfunc global RouterGetErrorStringA "RouterGetErrorStringA" int, sptr ; res = RouterGetErrorStringA(dwErrorCode, varptr(lplpszErrorString)) ; dwErrorCode : DWORD -> "int" ; lplpszErrorString : LPSTR* out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; DWORD RouterGetErrorStringA(DWORD dwErrorCode, LPSTR* lplpszErrorString) #uselib "rtutils.dll" #cfunc global RouterGetErrorStringA "RouterGetErrorStringA" int, var ; res = RouterGetErrorStringA(dwErrorCode, lplpszErrorString) ; dwErrorCode : DWORD -> "int" ; lplpszErrorString : LPSTR* out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; DWORD RouterGetErrorStringA(DWORD dwErrorCode, LPSTR* lplpszErrorString) #uselib "rtutils.dll" #cfunc global RouterGetErrorStringA "RouterGetErrorStringA" int, intptr ; res = RouterGetErrorStringA(dwErrorCode, varptr(lplpszErrorString)) ; dwErrorCode : DWORD -> "int" ; lplpszErrorString : LPSTR* out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
rtutils = windows.NewLazySystemDLL("rtutils.dll")
procRouterGetErrorStringA = rtutils.NewProc("RouterGetErrorStringA")
)
// dwErrorCode (DWORD), lplpszErrorString (LPSTR* out)
r1, _, err := procRouterGetErrorStringA.Call(
uintptr(dwErrorCode),
uintptr(lplpszErrorString),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // DWORDfunction RouterGetErrorStringA(
dwErrorCode: DWORD; // DWORD
lplpszErrorString: PPAnsiChar // LPSTR* out
): DWORD; stdcall;
external 'rtutils.dll' name 'RouterGetErrorStringA';result := DllCall("rtutils\RouterGetErrorStringA"
, "UInt", dwErrorCode ; DWORD
, "Ptr", lplpszErrorString ; LPSTR* out
, "UInt") ; return: DWORD●RouterGetErrorStringA(dwErrorCode, lplpszErrorString) = DLL("rtutils.dll", "dword RouterGetErrorStringA(dword, void*)")
# 呼び出し: RouterGetErrorStringA(dwErrorCode, lplpszErrorString)
# dwErrorCode : DWORD -> "dword"
# lplpszErrorString : LPSTR* out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。