ホーム › NetworkManagement.NetManagement › USER_INFO_2
USER_INFO_2
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| usri2_name | LPWSTR | 8/4 | +0 | +0 | ユーザーアカウント名。 |
| usri2_password | LPWSTR | 8/4 | +8 | +4 | アカウントのパスワード。取得時は通常空文字。 |
| usri2_password_age | DWORD | 4 | +16 | +8 | 前回のパスワード変更からの経過時間(秒)。 |
| usri2_priv | USER_PRIV | 4 | +20 | +12 | ユーザーの権限レベル(ゲスト/ユーザー/管理者)。 |
| usri2_home_dir | LPWSTR | 8/4 | +24 | +16 | ホームディレクトリのパス。 |
| usri2_comment | LPWSTR | 8/4 | +32 | +20 | アカウントのコメント。 |
| usri2_flags | USER_ACCOUNT_FLAGS | 4 | +40 | +24 | アカウントの動作と状態を示すフラグ。 |
| usri2_script_path | LPWSTR | 8/4 | +48 | +28 | ログオンスクリプトのパス。 |
| usri2_auth_flags | AF_OP | 4 | +56 | +32 | 操作者(管理)権限を示す認可フラグ。 |
| usri2_full_name | LPWSTR | 8/4 | +64 | +36 | ユーザーのフルネーム。 |
| usri2_usr_comment | LPWSTR | 8/4 | +72 | +40 | ユーザー自身が設定するコメント。 |
| usri2_parms | LPWSTR | 8/4 | +80 | +44 | アプリケーション固有のパラメータ領域。 |
| usri2_workstations | LPWSTR | 8/4 | +88 | +48 | ログオンを許可するワークステーション一覧(カンマ区切り)。 |
| usri2_last_logon | DWORD | 4 | +96 | +52 | 最後にログオンした日時(1970年起算秒)。 |
| usri2_last_logoff | DWORD | 4 | +100 | +56 | 最後にログオフした日時(1970年起算秒)。 |
| usri2_acct_expires | DWORD | 4 | +104 | +60 | アカウント有効期限(秒)。TIMEQ_FOREVERで無期限。 |
| usri2_max_storage | DWORD | 4 | +108 | +64 | ユーザーに許可される最大ディスク容量(バイト)。 |
| usri2_units_per_week | DWORD | 4 | +112 | +68 | ログオン時間を表す週あたりの単位数。 |
| usri2_logon_hours | BYTE* | 8/4 | +120 | +72 | ログオン可能時間帯を表すビットマップへのポインタ。 |
| usri2_bad_pw_count | DWORD | 4 | +128 | +76 | 誤ったパスワード入力の回数。 |
| usri2_num_logons | DWORD | 4 | +132 | +80 | このアカウントの累計ログオン回数。 |
| usri2_logon_server | LPWSTR | 8/4 | +136 | +84 | ログオンを処理するサーバー名。 |
| usri2_country_code | DWORD | 4 | +144 | +88 | ユーザーの国コード。 |
| usri2_code_page | DWORD | 4 | +148 | +92 | ユーザーのコードページ。 |
各言語での定義
#include <windows.h>
// USER_INFO_2 (x64 152 / x86 96 バイト)
typedef struct USER_INFO_2 {
LPWSTR usri2_name;
LPWSTR usri2_password;
DWORD usri2_password_age;
USER_PRIV usri2_priv;
LPWSTR usri2_home_dir;
LPWSTR usri2_comment;
USER_ACCOUNT_FLAGS usri2_flags;
LPWSTR usri2_script_path;
AF_OP usri2_auth_flags;
LPWSTR usri2_full_name;
LPWSTR usri2_usr_comment;
LPWSTR usri2_parms;
LPWSTR usri2_workstations;
DWORD usri2_last_logon;
DWORD usri2_last_logoff;
DWORD usri2_acct_expires;
DWORD usri2_max_storage;
DWORD usri2_units_per_week;
BYTE* usri2_logon_hours;
DWORD usri2_bad_pw_count;
DWORD usri2_num_logons;
LPWSTR usri2_logon_server;
DWORD usri2_country_code;
DWORD usri2_code_page;
} USER_INFO_2;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct USER_INFO_2
{
public IntPtr usri2_name;
public IntPtr usri2_password;
public uint usri2_password_age;
public uint usri2_priv;
public IntPtr usri2_home_dir;
public IntPtr usri2_comment;
public uint usri2_flags;
public IntPtr usri2_script_path;
public uint usri2_auth_flags;
public IntPtr usri2_full_name;
public IntPtr usri2_usr_comment;
public IntPtr usri2_parms;
public IntPtr usri2_workstations;
public uint usri2_last_logon;
public uint usri2_last_logoff;
public uint usri2_acct_expires;
public uint usri2_max_storage;
public uint usri2_units_per_week;
public IntPtr usri2_logon_hours;
public uint usri2_bad_pw_count;
public uint usri2_num_logons;
public IntPtr usri2_logon_server;
public uint usri2_country_code;
public uint usri2_code_page;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure USER_INFO_2
Public usri2_name As IntPtr
Public usri2_password As IntPtr
Public usri2_password_age As UInteger
Public usri2_priv As UInteger
Public usri2_home_dir As IntPtr
Public usri2_comment As IntPtr
Public usri2_flags As UInteger
Public usri2_script_path As IntPtr
Public usri2_auth_flags As UInteger
Public usri2_full_name As IntPtr
Public usri2_usr_comment As IntPtr
Public usri2_parms As IntPtr
Public usri2_workstations As IntPtr
Public usri2_last_logon As UInteger
Public usri2_last_logoff As UInteger
Public usri2_acct_expires As UInteger
Public usri2_max_storage As UInteger
Public usri2_units_per_week As UInteger
Public usri2_logon_hours As IntPtr
Public usri2_bad_pw_count As UInteger
Public usri2_num_logons As UInteger
Public usri2_logon_server As IntPtr
Public usri2_country_code As UInteger
Public usri2_code_page As UInteger
End Structureimport ctypes
from ctypes import wintypes
class USER_INFO_2(ctypes.Structure):
_fields_ = [
("usri2_name", ctypes.c_void_p),
("usri2_password", ctypes.c_void_p),
("usri2_password_age", wintypes.DWORD),
("usri2_priv", wintypes.DWORD),
("usri2_home_dir", ctypes.c_void_p),
("usri2_comment", ctypes.c_void_p),
("usri2_flags", wintypes.DWORD),
("usri2_script_path", ctypes.c_void_p),
("usri2_auth_flags", wintypes.DWORD),
("usri2_full_name", ctypes.c_void_p),
("usri2_usr_comment", ctypes.c_void_p),
("usri2_parms", ctypes.c_void_p),
("usri2_workstations", ctypes.c_void_p),
("usri2_last_logon", wintypes.DWORD),
("usri2_last_logoff", wintypes.DWORD),
("usri2_acct_expires", wintypes.DWORD),
("usri2_max_storage", wintypes.DWORD),
("usri2_units_per_week", wintypes.DWORD),
("usri2_logon_hours", ctypes.c_void_p),
("usri2_bad_pw_count", wintypes.DWORD),
("usri2_num_logons", wintypes.DWORD),
("usri2_logon_server", ctypes.c_void_p),
("usri2_country_code", wintypes.DWORD),
("usri2_code_page", wintypes.DWORD),
]#[repr(C)]
pub struct USER_INFO_2 {
pub usri2_name: *mut core::ffi::c_void,
pub usri2_password: *mut core::ffi::c_void,
pub usri2_password_age: u32,
pub usri2_priv: u32,
pub usri2_home_dir: *mut core::ffi::c_void,
pub usri2_comment: *mut core::ffi::c_void,
pub usri2_flags: u32,
pub usri2_script_path: *mut core::ffi::c_void,
pub usri2_auth_flags: u32,
pub usri2_full_name: *mut core::ffi::c_void,
pub usri2_usr_comment: *mut core::ffi::c_void,
pub usri2_parms: *mut core::ffi::c_void,
pub usri2_workstations: *mut core::ffi::c_void,
pub usri2_last_logon: u32,
pub usri2_last_logoff: u32,
pub usri2_acct_expires: u32,
pub usri2_max_storage: u32,
pub usri2_units_per_week: u32,
pub usri2_logon_hours: *mut core::ffi::c_void,
pub usri2_bad_pw_count: u32,
pub usri2_num_logons: u32,
pub usri2_logon_server: *mut core::ffi::c_void,
pub usri2_country_code: u32,
pub usri2_code_page: u32,
}import "golang.org/x/sys/windows"
type USER_INFO_2 struct {
usri2_name uintptr
usri2_password uintptr
usri2_password_age uint32
usri2_priv uint32
usri2_home_dir uintptr
usri2_comment uintptr
usri2_flags uint32
usri2_script_path uintptr
usri2_auth_flags uint32
usri2_full_name uintptr
usri2_usr_comment uintptr
usri2_parms uintptr
usri2_workstations uintptr
usri2_last_logon uint32
usri2_last_logoff uint32
usri2_acct_expires uint32
usri2_max_storage uint32
usri2_units_per_week uint32
usri2_logon_hours uintptr
usri2_bad_pw_count uint32
usri2_num_logons uint32
usri2_logon_server uintptr
usri2_country_code uint32
usri2_code_page uint32
}type
USER_INFO_2 = record
usri2_name: Pointer;
usri2_password: Pointer;
usri2_password_age: DWORD;
usri2_priv: DWORD;
usri2_home_dir: Pointer;
usri2_comment: Pointer;
usri2_flags: DWORD;
usri2_script_path: Pointer;
usri2_auth_flags: DWORD;
usri2_full_name: Pointer;
usri2_usr_comment: Pointer;
usri2_parms: Pointer;
usri2_workstations: Pointer;
usri2_last_logon: DWORD;
usri2_last_logoff: DWORD;
usri2_acct_expires: DWORD;
usri2_max_storage: DWORD;
usri2_units_per_week: DWORD;
usri2_logon_hours: Pointer;
usri2_bad_pw_count: DWORD;
usri2_num_logons: DWORD;
usri2_logon_server: Pointer;
usri2_country_code: DWORD;
usri2_code_page: DWORD;
end;const USER_INFO_2 = extern struct {
usri2_name: ?*anyopaque,
usri2_password: ?*anyopaque,
usri2_password_age: u32,
usri2_priv: u32,
usri2_home_dir: ?*anyopaque,
usri2_comment: ?*anyopaque,
usri2_flags: u32,
usri2_script_path: ?*anyopaque,
usri2_auth_flags: u32,
usri2_full_name: ?*anyopaque,
usri2_usr_comment: ?*anyopaque,
usri2_parms: ?*anyopaque,
usri2_workstations: ?*anyopaque,
usri2_last_logon: u32,
usri2_last_logoff: u32,
usri2_acct_expires: u32,
usri2_max_storage: u32,
usri2_units_per_week: u32,
usri2_logon_hours: ?*anyopaque,
usri2_bad_pw_count: u32,
usri2_num_logons: u32,
usri2_logon_server: ?*anyopaque,
usri2_country_code: u32,
usri2_code_page: u32,
};type
USER_INFO_2 {.bycopy.} = object
usri2_name: pointer
usri2_password: pointer
usri2_password_age: uint32
usri2_priv: uint32
usri2_home_dir: pointer
usri2_comment: pointer
usri2_flags: uint32
usri2_script_path: pointer
usri2_auth_flags: uint32
usri2_full_name: pointer
usri2_usr_comment: pointer
usri2_parms: pointer
usri2_workstations: pointer
usri2_last_logon: uint32
usri2_last_logoff: uint32
usri2_acct_expires: uint32
usri2_max_storage: uint32
usri2_units_per_week: uint32
usri2_logon_hours: pointer
usri2_bad_pw_count: uint32
usri2_num_logons: uint32
usri2_logon_server: pointer
usri2_country_code: uint32
usri2_code_page: uint32struct USER_INFO_2
{
void* usri2_name;
void* usri2_password;
uint usri2_password_age;
uint usri2_priv;
void* usri2_home_dir;
void* usri2_comment;
uint usri2_flags;
void* usri2_script_path;
uint usri2_auth_flags;
void* usri2_full_name;
void* usri2_usr_comment;
void* usri2_parms;
void* usri2_workstations;
uint usri2_last_logon;
uint usri2_last_logoff;
uint usri2_acct_expires;
uint usri2_max_storage;
uint usri2_units_per_week;
void* usri2_logon_hours;
uint usri2_bad_pw_count;
uint usri2_num_logons;
void* usri2_logon_server;
uint usri2_country_code;
uint usri2_code_page;
}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_2 サイズ: 96 バイト(x86)
dim st, 24 ; 4byte整数×24(構造体サイズ 96 / 4 切り上げ)
; usri2_name : LPWSTR (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; usri2_password : LPWSTR (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; usri2_password_age : DWORD (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; usri2_priv : USER_PRIV (+12, 4byte) st.3 = 値 / 値 = st.3 (lpoke/lpeek も可)
; usri2_home_dir : LPWSTR (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; usri2_comment : LPWSTR (+20, 4byte) st.5 = 値 / 値 = st.5 (lpoke/lpeek も可)
; usri2_flags : USER_ACCOUNT_FLAGS (+24, 4byte) st.6 = 値 / 値 = st.6 (lpoke/lpeek も可)
; usri2_script_path : LPWSTR (+28, 4byte) st.7 = 値 / 値 = st.7 (lpoke/lpeek も可)
; usri2_auth_flags : AF_OP (+32, 4byte) st.8 = 値 / 値 = st.8 (lpoke/lpeek も可)
; usri2_full_name : LPWSTR (+36, 4byte) st.9 = 値 / 値 = st.9 (lpoke/lpeek も可)
; usri2_usr_comment : LPWSTR (+40, 4byte) st.10 = 値 / 値 = st.10 (lpoke/lpeek も可)
; usri2_parms : LPWSTR (+44, 4byte) st.11 = 値 / 値 = st.11 (lpoke/lpeek も可)
; usri2_workstations : LPWSTR (+48, 4byte) st.12 = 値 / 値 = st.12 (lpoke/lpeek も可)
; usri2_last_logon : DWORD (+52, 4byte) st.13 = 値 / 値 = st.13 (lpoke/lpeek も可)
; usri2_last_logoff : DWORD (+56, 4byte) st.14 = 値 / 値 = st.14 (lpoke/lpeek も可)
; usri2_acct_expires : DWORD (+60, 4byte) st.15 = 値 / 値 = st.15 (lpoke/lpeek も可)
; usri2_max_storage : DWORD (+64, 4byte) st.16 = 値 / 値 = st.16 (lpoke/lpeek も可)
; usri2_units_per_week : DWORD (+68, 4byte) st.17 = 値 / 値 = st.17 (lpoke/lpeek も可)
; usri2_logon_hours : BYTE* (+72, 4byte) st.18 = 値 / 値 = st.18 (lpoke/lpeek も可)
; usri2_bad_pw_count : DWORD (+76, 4byte) st.19 = 値 / 値 = st.19 (lpoke/lpeek も可)
; usri2_num_logons : DWORD (+80, 4byte) st.20 = 値 / 値 = st.20 (lpoke/lpeek も可)
; usri2_logon_server : LPWSTR (+84, 4byte) st.21 = 値 / 値 = st.21 (lpoke/lpeek も可)
; usri2_country_code : DWORD (+88, 4byte) st.22 = 値 / 値 = st.22 (lpoke/lpeek も可)
; usri2_code_page : DWORD (+92, 4byte) st.23 = 値 / 値 = st.23 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; USER_INFO_2 サイズ: 152 バイト(x64)
dim st, 38 ; 4byte整数×38(構造体サイズ 152 / 4 切り上げ)
; usri2_name : LPWSTR (+0, 8byte) qpoke st,0,値 / qpeek(st,0) ※IronHSPのみ。3.7/3.8は lpoke st,0,下位 : lpoke st,4,上位
; usri2_password : LPWSTR (+8, 8byte) qpoke st,8,値 / qpeek(st,8) ※IronHSPのみ。3.7/3.8は lpoke st,8,下位 : lpoke st,12,上位
; usri2_password_age : DWORD (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; usri2_priv : USER_PRIV (+20, 4byte) st.5 = 値 / 値 = st.5 (lpoke/lpeek も可)
; usri2_home_dir : LPWSTR (+24, 8byte) qpoke st,24,値 / qpeek(st,24) ※IronHSPのみ。3.7/3.8は lpoke st,24,下位 : lpoke st,28,上位
; usri2_comment : LPWSTR (+32, 8byte) qpoke st,32,値 / qpeek(st,32) ※IronHSPのみ。3.7/3.8は lpoke st,32,下位 : lpoke st,36,上位
; usri2_flags : USER_ACCOUNT_FLAGS (+40, 4byte) st.10 = 値 / 値 = st.10 (lpoke/lpeek も可)
; usri2_script_path : LPWSTR (+48, 8byte) qpoke st,48,値 / qpeek(st,48) ※IronHSPのみ。3.7/3.8は lpoke st,48,下位 : lpoke st,52,上位
; usri2_auth_flags : AF_OP (+56, 4byte) st.14 = 値 / 値 = st.14 (lpoke/lpeek も可)
; usri2_full_name : LPWSTR (+64, 8byte) qpoke st,64,値 / qpeek(st,64) ※IronHSPのみ。3.7/3.8は lpoke st,64,下位 : lpoke st,68,上位
; usri2_usr_comment : LPWSTR (+72, 8byte) qpoke st,72,値 / qpeek(st,72) ※IronHSPのみ。3.7/3.8は lpoke st,72,下位 : lpoke st,76,上位
; usri2_parms : LPWSTR (+80, 8byte) qpoke st,80,値 / qpeek(st,80) ※IronHSPのみ。3.7/3.8は lpoke st,80,下位 : lpoke st,84,上位
; usri2_workstations : LPWSTR (+88, 8byte) qpoke st,88,値 / qpeek(st,88) ※IronHSPのみ。3.7/3.8は lpoke st,88,下位 : lpoke st,92,上位
; usri2_last_logon : DWORD (+96, 4byte) st.24 = 値 / 値 = st.24 (lpoke/lpeek も可)
; usri2_last_logoff : DWORD (+100, 4byte) st.25 = 値 / 値 = st.25 (lpoke/lpeek も可)
; usri2_acct_expires : DWORD (+104, 4byte) st.26 = 値 / 値 = st.26 (lpoke/lpeek も可)
; usri2_max_storage : DWORD (+108, 4byte) st.27 = 値 / 値 = st.27 (lpoke/lpeek も可)
; usri2_units_per_week : DWORD (+112, 4byte) st.28 = 値 / 値 = st.28 (lpoke/lpeek も可)
; usri2_logon_hours : BYTE* (+120, 8byte) qpoke st,120,値 / qpeek(st,120) ※IronHSPのみ。3.7/3.8は lpoke st,120,下位 : lpoke st,124,上位
; usri2_bad_pw_count : DWORD (+128, 4byte) st.32 = 値 / 値 = st.32 (lpoke/lpeek も可)
; usri2_num_logons : DWORD (+132, 4byte) st.33 = 値 / 値 = st.33 (lpoke/lpeek も可)
; usri2_logon_server : LPWSTR (+136, 8byte) qpoke st,136,値 / qpeek(st,136) ※IronHSPのみ。3.7/3.8は lpoke st,136,下位 : lpoke st,140,上位
; usri2_country_code : DWORD (+144, 4byte) st.36 = 値 / 値 = st.36 (lpoke/lpeek も可)
; usri2_code_page : DWORD (+148, 4byte) st.37 = 値 / 値 = st.37 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global USER_INFO_2
#field intptr usri2_name
#field intptr usri2_password
#field int usri2_password_age
#field int usri2_priv
#field intptr usri2_home_dir
#field intptr usri2_comment
#field int usri2_flags
#field intptr usri2_script_path
#field int usri2_auth_flags
#field intptr usri2_full_name
#field intptr usri2_usr_comment
#field intptr usri2_parms
#field intptr usri2_workstations
#field int usri2_last_logon
#field int usri2_last_logoff
#field int usri2_acct_expires
#field int usri2_max_storage
#field int usri2_units_per_week
#field intptr usri2_logon_hours
#field int usri2_bad_pw_count
#field int usri2_num_logons
#field intptr usri2_logon_server
#field int usri2_country_code
#field int usri2_code_page
#endstruct
stdim st, USER_INFO_2 ; NSTRUCT 変数を確保
st->usri2_password_age = 100
mes "usri2_password_age=" + st->usri2_password_age