ホーム › NetworkManagement.Rras › SECURITY_MESSAGE
SECURITY_MESSAGE
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| dwMsgId | SECURITY_MESSAGE_MSG_ID | 4 | +0 | +0 | セキュリティメッセージの種別を表すSECURITY_MESSAGE_MSG_ID値。 |
| hPort | INT_PTR | 8/4 | +8 | +4 | このメッセージが関連付くポートのハンドル。 |
| dwError | DWORD | 4 | +16 | +8 | セキュリティ処理で発生したエラーコード。0なら正常。 |
| UserName | CHAR | 257 | +20 | +12 | 認証されたユーザーの名前(ANSI文字列)。 |
| Domain | CHAR | 16 | +277 | +269 | 認証されたユーザーのドメイン名(ANSI文字列)。 |
各言語での定義
#include <windows.h>
// SECURITY_MESSAGE (x64 296 / x86 288 バイト)
typedef struct SECURITY_MESSAGE {
SECURITY_MESSAGE_MSG_ID dwMsgId;
INT_PTR hPort;
DWORD dwError;
CHAR UserName[257];
CHAR Domain[16];
} SECURITY_MESSAGE;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct SECURITY_MESSAGE
{
public uint dwMsgId;
public IntPtr hPort;
public uint dwError;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 257)] public sbyte[] UserName;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] public sbyte[] Domain;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure SECURITY_MESSAGE
Public dwMsgId As UInteger
Public hPort As IntPtr
Public dwError As UInteger
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=257)> Public UserName() As SByte
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=16)> Public Domain() As SByte
End Structureimport ctypes
from ctypes import wintypes
class SECURITY_MESSAGE(ctypes.Structure):
_fields_ = [
("dwMsgId", wintypes.DWORD),
("hPort", ctypes.c_ssize_t),
("dwError", wintypes.DWORD),
("UserName", ctypes.c_byte * 257),
("Domain", ctypes.c_byte * 16),
]#[repr(C)]
pub struct SECURITY_MESSAGE {
pub dwMsgId: u32,
pub hPort: isize,
pub dwError: u32,
pub UserName: [i8; 257],
pub Domain: [i8; 16],
}import "golang.org/x/sys/windows"
type SECURITY_MESSAGE struct {
dwMsgId uint32
hPort uintptr
dwError uint32
UserName [257]int8
Domain [16]int8
}type
SECURITY_MESSAGE = record
dwMsgId: DWORD;
hPort: NativeInt;
dwError: DWORD;
UserName: array[0..256] of Shortint;
Domain: array[0..15] of Shortint;
end;const SECURITY_MESSAGE = extern struct {
dwMsgId: u32,
hPort: isize,
dwError: u32,
UserName: [257]i8,
Domain: [16]i8,
};type
SECURITY_MESSAGE {.bycopy.} = object
dwMsgId: uint32
hPort: int
dwError: uint32
UserName: array[257, int8]
Domain: array[16, int8]struct SECURITY_MESSAGE
{
uint dwMsgId;
ptrdiff_t hPort;
uint dwError;
byte[257] UserName;
byte[16] Domain;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; SECURITY_MESSAGE サイズ: 288 バイト(x86)
dim st, 72 ; 4byte整数×72(構造体サイズ 288 / 4 切り上げ)
; dwMsgId : SECURITY_MESSAGE_MSG_ID (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; hPort : INT_PTR (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; dwError : DWORD (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; UserName : CHAR (+12, 257byte) varptr(st)+12 を基点に操作(257byte:入れ子/配列)
; Domain : CHAR (+269, 16byte) varptr(st)+269 を基点に操作(16byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; SECURITY_MESSAGE サイズ: 296 バイト(x64)
dim st, 74 ; 4byte整数×74(構造体サイズ 296 / 4 切り上げ)
; dwMsgId : SECURITY_MESSAGE_MSG_ID (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; hPort : INT_PTR (+8, 8byte) qpoke st,8,値 / qpeek(st,8) ※IronHSPのみ。3.7/3.8は lpoke st,8,下位 : lpoke st,12,上位
; dwError : DWORD (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; UserName : CHAR (+20, 257byte) varptr(st)+20 を基点に操作(257byte:入れ子/配列)
; Domain : CHAR (+277, 16byte) varptr(st)+277 を基点に操作(16byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global SECURITY_MESSAGE
#field int dwMsgId
#field intptr hPort
#field int dwError
#field byte UserName 257
#field byte Domain 16
#endstruct
stdim st, SECURITY_MESSAGE ; NSTRUCT 変数を確保
st->dwMsgId = 100
mes "dwMsgId=" + st->dwMsgId