ホーム › System.WindowsProgramming › WINSTATIONINFORMATIONW
WINSTATIONINFORMATIONW
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| Reserved2 | BYTE | 70 | +0 | +0 | 予約バイト配列。 |
| LogonId | DWORD | 4 | +72 | +72 | ウィンドウステーションのログオンセッションID。 |
| Reserved3 | BYTE | 1140 | +76 | +76 | 予約バイト配列。 |
各言語での定義
#include <windows.h>
// WINSTATIONINFORMATIONW (x64 1216 / x86 1216 バイト)
typedef struct WINSTATIONINFORMATIONW {
BYTE Reserved2[70];
DWORD LogonId;
BYTE Reserved3[1140];
} WINSTATIONINFORMATIONW;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct WINSTATIONINFORMATIONW
{
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 70)] public byte[] Reserved2;
public uint LogonId;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 1140)] public byte[] Reserved3;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure WINSTATIONINFORMATIONW
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=70)> Public Reserved2() As Byte
Public LogonId As UInteger
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=1140)> Public Reserved3() As Byte
End Structureimport ctypes
from ctypes import wintypes
class WINSTATIONINFORMATIONW(ctypes.Structure):
_fields_ = [
("Reserved2", ctypes.c_ubyte * 70),
("LogonId", wintypes.DWORD),
("Reserved3", ctypes.c_ubyte * 1140),
]#[repr(C)]
pub struct WINSTATIONINFORMATIONW {
pub Reserved2: [u8; 70],
pub LogonId: u32,
pub Reserved3: [u8; 1140],
}import "golang.org/x/sys/windows"
type WINSTATIONINFORMATIONW struct {
Reserved2 [70]byte
LogonId uint32
Reserved3 [1140]byte
}type
WINSTATIONINFORMATIONW = record
Reserved2: array[0..69] of Byte;
LogonId: DWORD;
Reserved3: array[0..1139] of Byte;
end;const WINSTATIONINFORMATIONW = extern struct {
Reserved2: [70]u8,
LogonId: u32,
Reserved3: [1140]u8,
};type
WINSTATIONINFORMATIONW {.bycopy.} = object
Reserved2: array[70, uint8]
LogonId: uint32
Reserved3: array[1140, uint8]struct WINSTATIONINFORMATIONW
{
ubyte[70] Reserved2;
uint LogonId;
ubyte[1140] Reserved3;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; WINSTATIONINFORMATIONW サイズ: 1216 バイト(x64)
dim st, 304 ; 4byte整数×304(構造体サイズ 1216 / 4 切り上げ)
; Reserved2 : BYTE (+0, 70byte) varptr(st)+0 を基点に操作(70byte:入れ子/配列)
; LogonId : DWORD (+72, 4byte) st.18 = 値 / 値 = st.18 (lpoke/lpeek も可)
; Reserved3 : BYTE (+76, 1140byte) varptr(st)+76 を基点に操作(1140byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global WINSTATIONINFORMATIONW
#field byte Reserved2 70
#field int LogonId
#field byte Reserved3 1140
#endstruct
stdim st, WINSTATIONINFORMATIONW ; NSTRUCT 変数を確保
st->LogonId = 100
mes "LogonId=" + st->LogonId