ホーム › NetworkManagement.Rras › RAS_SECURITY_INFO
RAS_SECURITY_INFO
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| LastError | DWORD | 4 | +0 | +0 | セキュリティDLLで最後に発生したエラーコード。0なら正常。 |
| BytesReceived | DWORD | 4 | +4 | +4 | セキュリティ交渉で受信したバイト数。 |
| DeviceName | CHAR | 129 | +8 | +8 | セキュリティ処理対象のデバイス名(ANSI文字列)。 |
各言語での定義
#include <windows.h>
// RAS_SECURITY_INFO (x64 140 / x86 140 バイト)
typedef struct RAS_SECURITY_INFO {
DWORD LastError;
DWORD BytesReceived;
CHAR DeviceName[129];
} RAS_SECURITY_INFO;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct RAS_SECURITY_INFO
{
public uint LastError;
public uint BytesReceived;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 129)] public sbyte[] DeviceName;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure RAS_SECURITY_INFO
Public LastError As UInteger
Public BytesReceived As UInteger
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=129)> Public DeviceName() As SByte
End Structureimport ctypes
from ctypes import wintypes
class RAS_SECURITY_INFO(ctypes.Structure):
_fields_ = [
("LastError", wintypes.DWORD),
("BytesReceived", wintypes.DWORD),
("DeviceName", ctypes.c_byte * 129),
]#[repr(C)]
pub struct RAS_SECURITY_INFO {
pub LastError: u32,
pub BytesReceived: u32,
pub DeviceName: [i8; 129],
}import "golang.org/x/sys/windows"
type RAS_SECURITY_INFO struct {
LastError uint32
BytesReceived uint32
DeviceName [129]int8
}type
RAS_SECURITY_INFO = record
LastError: DWORD;
BytesReceived: DWORD;
DeviceName: array[0..128] of Shortint;
end;const RAS_SECURITY_INFO = extern struct {
LastError: u32,
BytesReceived: u32,
DeviceName: [129]i8,
};type
RAS_SECURITY_INFO {.bycopy.} = object
LastError: uint32
BytesReceived: uint32
DeviceName: array[129, int8]struct RAS_SECURITY_INFO
{
uint LastError;
uint BytesReceived;
byte[129] DeviceName;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; RAS_SECURITY_INFO サイズ: 140 バイト(x64)
dim st, 35 ; 4byte整数×35(構造体サイズ 140 / 4 切り上げ)
; LastError : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; BytesReceived : DWORD (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; DeviceName : CHAR (+8, 129byte) varptr(st)+8 を基点に操作(129byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global RAS_SECURITY_INFO
#field int LastError
#field int BytesReceived
#field byte DeviceName 129
#endstruct
stdim st, RAS_SECURITY_INFO ; NSTRUCT 変数を確保
st->LastError = 100
mes "LastError=" + st->LastError