ホーム › NetworkManagement.NetManagement › USER_INFO_1
USER_INFO_1
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| usri1_name | LPWSTR | 8/4 | +0 | +0 | ユーザーアカウント名。 |
| usri1_password | LPWSTR | 8/4 | +8 | +4 | アカウントのパスワード。取得時は通常空文字。 |
| usri1_password_age | DWORD | 4 | +16 | +8 | 前回のパスワード変更からの経過時間(秒)。 |
| usri1_priv | USER_PRIV | 4 | +20 | +12 | ユーザーの権限レベル(ゲスト/ユーザー/管理者)。 |
| usri1_home_dir | LPWSTR | 8/4 | +24 | +16 | ホームディレクトリのパス。 |
| usri1_comment | LPWSTR | 8/4 | +32 | +20 | アカウントのコメント。 |
| usri1_flags | USER_ACCOUNT_FLAGS | 4 | +40 | +24 | アカウントの動作と状態を示すフラグ。 |
| usri1_script_path | LPWSTR | 8/4 | +48 | +28 | ログオンスクリプトのパス。 |
各言語での定義
#include <windows.h>
// USER_INFO_1 (x64 56 / x86 32 バイト)
typedef struct USER_INFO_1 {
LPWSTR usri1_name;
LPWSTR usri1_password;
DWORD usri1_password_age;
USER_PRIV usri1_priv;
LPWSTR usri1_home_dir;
LPWSTR usri1_comment;
USER_ACCOUNT_FLAGS usri1_flags;
LPWSTR usri1_script_path;
} USER_INFO_1;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct USER_INFO_1
{
public IntPtr usri1_name;
public IntPtr usri1_password;
public uint usri1_password_age;
public uint usri1_priv;
public IntPtr usri1_home_dir;
public IntPtr usri1_comment;
public uint usri1_flags;
public IntPtr usri1_script_path;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure USER_INFO_1
Public usri1_name As IntPtr
Public usri1_password As IntPtr
Public usri1_password_age As UInteger
Public usri1_priv As UInteger
Public usri1_home_dir As IntPtr
Public usri1_comment As IntPtr
Public usri1_flags As UInteger
Public usri1_script_path As IntPtr
End Structureimport ctypes
from ctypes import wintypes
class USER_INFO_1(ctypes.Structure):
_fields_ = [
("usri1_name", ctypes.c_void_p),
("usri1_password", ctypes.c_void_p),
("usri1_password_age", wintypes.DWORD),
("usri1_priv", wintypes.DWORD),
("usri1_home_dir", ctypes.c_void_p),
("usri1_comment", ctypes.c_void_p),
("usri1_flags", wintypes.DWORD),
("usri1_script_path", ctypes.c_void_p),
]#[repr(C)]
pub struct USER_INFO_1 {
pub usri1_name: *mut core::ffi::c_void,
pub usri1_password: *mut core::ffi::c_void,
pub usri1_password_age: u32,
pub usri1_priv: u32,
pub usri1_home_dir: *mut core::ffi::c_void,
pub usri1_comment: *mut core::ffi::c_void,
pub usri1_flags: u32,
pub usri1_script_path: *mut core::ffi::c_void,
}import "golang.org/x/sys/windows"
type USER_INFO_1 struct {
usri1_name uintptr
usri1_password uintptr
usri1_password_age uint32
usri1_priv uint32
usri1_home_dir uintptr
usri1_comment uintptr
usri1_flags uint32
usri1_script_path uintptr
}type
USER_INFO_1 = record
usri1_name: Pointer;
usri1_password: Pointer;
usri1_password_age: DWORD;
usri1_priv: DWORD;
usri1_home_dir: Pointer;
usri1_comment: Pointer;
usri1_flags: DWORD;
usri1_script_path: Pointer;
end;const USER_INFO_1 = extern struct {
usri1_name: ?*anyopaque,
usri1_password: ?*anyopaque,
usri1_password_age: u32,
usri1_priv: u32,
usri1_home_dir: ?*anyopaque,
usri1_comment: ?*anyopaque,
usri1_flags: u32,
usri1_script_path: ?*anyopaque,
};type
USER_INFO_1 {.bycopy.} = object
usri1_name: pointer
usri1_password: pointer
usri1_password_age: uint32
usri1_priv: uint32
usri1_home_dir: pointer
usri1_comment: pointer
usri1_flags: uint32
usri1_script_path: pointerstruct USER_INFO_1
{
void* usri1_name;
void* usri1_password;
uint usri1_password_age;
uint usri1_priv;
void* usri1_home_dir;
void* usri1_comment;
uint usri1_flags;
void* usri1_script_path;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; USER_INFO_1 サイズ: 32 バイト(x86)
dim st, 8 ; 4byte整数×8(構造体サイズ 32 / 4 切り上げ)
; usri1_name : LPWSTR (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; usri1_password : LPWSTR (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; usri1_password_age : DWORD (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; usri1_priv : USER_PRIV (+12, 4byte) st.3 = 値 / 値 = st.3 (lpoke/lpeek も可)
; usri1_home_dir : LPWSTR (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; usri1_comment : LPWSTR (+20, 4byte) st.5 = 値 / 値 = st.5 (lpoke/lpeek も可)
; usri1_flags : USER_ACCOUNT_FLAGS (+24, 4byte) st.6 = 値 / 値 = st.6 (lpoke/lpeek も可)
; usri1_script_path : LPWSTR (+28, 4byte) st.7 = 値 / 値 = st.7 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; USER_INFO_1 サイズ: 56 バイト(x64)
dim st, 14 ; 4byte整数×14(構造体サイズ 56 / 4 切り上げ)
; usri1_name : LPWSTR (+0, 8byte) qpoke st,0,値 / qpeek(st,0) ※IronHSPのみ。3.7/3.8は lpoke st,0,下位 : lpoke st,4,上位
; usri1_password : LPWSTR (+8, 8byte) qpoke st,8,値 / qpeek(st,8) ※IronHSPのみ。3.7/3.8は lpoke st,8,下位 : lpoke st,12,上位
; usri1_password_age : DWORD (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; usri1_priv : USER_PRIV (+20, 4byte) st.5 = 値 / 値 = st.5 (lpoke/lpeek も可)
; usri1_home_dir : LPWSTR (+24, 8byte) qpoke st,24,値 / qpeek(st,24) ※IronHSPのみ。3.7/3.8は lpoke st,24,下位 : lpoke st,28,上位
; usri1_comment : LPWSTR (+32, 8byte) qpoke st,32,値 / qpeek(st,32) ※IronHSPのみ。3.7/3.8は lpoke st,32,下位 : lpoke st,36,上位
; usri1_flags : USER_ACCOUNT_FLAGS (+40, 4byte) st.10 = 値 / 値 = st.10 (lpoke/lpeek も可)
; usri1_script_path : LPWSTR (+48, 8byte) qpoke st,48,値 / qpeek(st,48) ※IronHSPのみ。3.7/3.8は lpoke st,48,下位 : lpoke st,52,上位
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global USER_INFO_1
#field intptr usri1_name
#field intptr usri1_password
#field int usri1_password_age
#field int usri1_priv
#field intptr usri1_home_dir
#field intptr usri1_comment
#field int usri1_flags
#field intptr usri1_script_path
#endstruct
stdim st, USER_INFO_1 ; NSTRUCT 変数を確保
st->usri1_password_age = 100
mes "usri1_password_age=" + st->usri1_password_age