ホーム › NetworkManagement.Rras › AUTH_VALIDATION_EX
AUTH_VALIDATION_EX
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| Header | MPRAPI_OBJECT_HEADER | 4 | +0 | +0 | オブジェクトのリビジョン・種別・サイズを示すMPRAPI_OBJECT_HEADER。 |
| hRasConnection | HANDLE | 8/4 | +8 | +4 | 検証対象のRAS接続を識別するハンドル。 |
| wszUserName | WCHAR | 514 | +16 | +8 | 認証されたユーザーの名前(ワイド文字列)。 |
| wszLogonDomain | WCHAR | 32 | +530 | +522 | ユーザーがログオンしたドメイン名(ワイド文字列)。 |
| AuthInfoSize | DWORD | 4 | +564 | +556 | AuthInfoが保持する認証情報のバイトサイズ。 |
| AuthInfo | BYTE | 1 | +568 | +560 | 認証情報を保持する可変長バイト配列(先頭バイト)。 |
各言語での定義
#include <windows.h>
// MPRAPI_OBJECT_HEADER (x64 4 / x86 4 バイト)
typedef struct MPRAPI_OBJECT_HEADER {
BYTE revision;
BYTE type;
WORD size;
} MPRAPI_OBJECT_HEADER;
// AUTH_VALIDATION_EX (x64 576 / x86 564 バイト)
typedef struct AUTH_VALIDATION_EX {
MPRAPI_OBJECT_HEADER Header;
HANDLE hRasConnection;
WCHAR wszUserName[257];
WCHAR wszLogonDomain[16];
DWORD AuthInfoSize;
BYTE AuthInfo[1];
} AUTH_VALIDATION_EX;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct MPRAPI_OBJECT_HEADER
{
public byte revision;
public byte type;
public ushort size;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct AUTH_VALIDATION_EX
{
public MPRAPI_OBJECT_HEADER Header;
public IntPtr hRasConnection;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 257)] public string wszUserName;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 16)] public string wszLogonDomain;
public uint AuthInfoSize;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 1)] public byte[] AuthInfo;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure MPRAPI_OBJECT_HEADER
Public revision As Byte
Public type As Byte
Public size As UShort
End Structure
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure AUTH_VALIDATION_EX
Public Header As MPRAPI_OBJECT_HEADER
Public hRasConnection As IntPtr
<MarshalAs(UnmanagedType.ByValTStr, SizeConst:=257)> Public wszUserName As String
<MarshalAs(UnmanagedType.ByValTStr, SizeConst:=16)> Public wszLogonDomain As String
Public AuthInfoSize As UInteger
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=1)> Public AuthInfo() As Byte
End Structureimport ctypes
from ctypes import wintypes
class MPRAPI_OBJECT_HEADER(ctypes.Structure):
_fields_ = [
("revision", ctypes.c_ubyte),
("type", ctypes.c_ubyte),
("size", ctypes.c_ushort),
]
class AUTH_VALIDATION_EX(ctypes.Structure):
_fields_ = [
("Header", MPRAPI_OBJECT_HEADER),
("hRasConnection", ctypes.c_void_p),
("wszUserName", ctypes.c_wchar * 257),
("wszLogonDomain", ctypes.c_wchar * 16),
("AuthInfoSize", wintypes.DWORD),
("AuthInfo", ctypes.c_ubyte * 1),
]#[repr(C)]
pub struct MPRAPI_OBJECT_HEADER {
pub revision: u8,
pub type: u8,
pub size: u16,
}
#[repr(C)]
pub struct AUTH_VALIDATION_EX {
pub Header: MPRAPI_OBJECT_HEADER,
pub hRasConnection: *mut core::ffi::c_void,
pub wszUserName: [u16; 257],
pub wszLogonDomain: [u16; 16],
pub AuthInfoSize: u32,
pub AuthInfo: [u8; 1],
}import "golang.org/x/sys/windows"
type MPRAPI_OBJECT_HEADER struct {
revision byte
type byte
size uint16
}
type AUTH_VALIDATION_EX struct {
Header MPRAPI_OBJECT_HEADER
hRasConnection uintptr
wszUserName [257]uint16
wszLogonDomain [16]uint16
AuthInfoSize uint32
AuthInfo [1]byte
}type
MPRAPI_OBJECT_HEADER = record
revision: Byte;
type: Byte;
size: Word;
end;
AUTH_VALIDATION_EX = record
Header: MPRAPI_OBJECT_HEADER;
hRasConnection: Pointer;
wszUserName: array[0..256] of WideChar;
wszLogonDomain: array[0..15] of WideChar;
AuthInfoSize: DWORD;
AuthInfo: array[0..0] of Byte;
end;const MPRAPI_OBJECT_HEADER = extern struct {
revision: u8,
type: u8,
size: u16,
};
const AUTH_VALIDATION_EX = extern struct {
Header: MPRAPI_OBJECT_HEADER,
hRasConnection: ?*anyopaque,
wszUserName: [257]u16,
wszLogonDomain: [16]u16,
AuthInfoSize: u32,
AuthInfo: [1]u8,
};type
MPRAPI_OBJECT_HEADER {.bycopy.} = object
revision: uint8
type: uint8
size: uint16
AUTH_VALIDATION_EX {.bycopy.} = object
Header: MPRAPI_OBJECT_HEADER
hRasConnection: pointer
wszUserName: array[257, uint16]
wszLogonDomain: array[16, uint16]
AuthInfoSize: uint32
AuthInfo: array[1, uint8]struct MPRAPI_OBJECT_HEADER
{
ubyte revision;
ubyte type;
ushort size;
}
struct AUTH_VALIDATION_EX
{
MPRAPI_OBJECT_HEADER Header;
void* hRasConnection;
wchar[257] wszUserName;
wchar[16] wszLogonDomain;
uint AuthInfoSize;
ubyte[1] AuthInfo;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; AUTH_VALIDATION_EX サイズ: 564 バイト(x86)
dim st, 141 ; 4byte整数×141(構造体サイズ 564 / 4 切り上げ)
; Header : MPRAPI_OBJECT_HEADER (+0, 4byte) varptr(st)+0 を基点に操作(4byte:入れ子/配列)
; hRasConnection : HANDLE (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; wszUserName : WCHAR (+8, 514byte) varptr(st)+8 を基点に操作(514byte:入れ子/配列)
; wszLogonDomain : WCHAR (+522, 32byte) varptr(st)+522 を基点に操作(32byte:入れ子/配列)
; AuthInfoSize : DWORD (+556, 4byte) st.139 = 値 / 値 = st.139 (lpoke/lpeek も可)
; AuthInfo : BYTE (+560, 1byte) varptr(st)+560 を基点に操作(1byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; AUTH_VALIDATION_EX サイズ: 576 バイト(x64)
dim st, 144 ; 4byte整数×144(構造体サイズ 576 / 4 切り上げ)
; Header : MPRAPI_OBJECT_HEADER (+0, 4byte) varptr(st)+0 を基点に操作(4byte:入れ子/配列)
; hRasConnection : HANDLE (+8, 8byte) qpoke st,8,値 / qpeek(st,8) ※IronHSPのみ。3.7/3.8は lpoke st,8,下位 : lpoke st,12,上位
; wszUserName : WCHAR (+16, 514byte) varptr(st)+16 を基点に操作(514byte:入れ子/配列)
; wszLogonDomain : WCHAR (+530, 32byte) varptr(st)+530 を基点に操作(32byte:入れ子/配列)
; AuthInfoSize : DWORD (+564, 4byte) st.141 = 値 / 値 = st.141 (lpoke/lpeek も可)
; AuthInfo : BYTE (+568, 1byte) varptr(st)+568 を基点に操作(1byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global MPRAPI_OBJECT_HEADER
#field byte revision
#field byte type
#field short size
#endstruct
#defstruct global AUTH_VALIDATION_EX
#field MPRAPI_OBJECT_HEADER Header
#field intptr hRasConnection
#field wchar wszUserName 257
#field wchar wszLogonDomain 16
#field int AuthInfoSize
#field byte AuthInfo 1
#endstruct
stdim st, AUTH_VALIDATION_EX ; NSTRUCT 変数を確保
st->AuthInfoSize = 100
mes "AuthInfoSize=" + st->AuthInfoSize