Win32 API 日本語リファレンス
ホームNetworkManagement.NetManagement › USER_INFO_22

USER_INFO_22

構造体
サイズx64: 160 バイト / x86: 108 バイト

サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。

フィールド

フィールドサイズx64x86説明
usri22_nameLPWSTR8/4+0+0ユーザーアカウント名。
usri22_passwordBYTE16+8+4暗号化されたパスワード情報(16バイト)。
usri22_password_ageDWORD4+24+20前回のパスワード変更からの経過時間(秒)。
usri22_privUSER_PRIV4+28+24ユーザーの権限レベル(ゲスト/ユーザー/管理者)。
usri22_home_dirLPWSTR8/4+32+28ホームディレクトリのパス。
usri22_commentLPWSTR8/4+40+32アカウントのコメント。
usri22_flagsUSER_ACCOUNT_FLAGS4+48+36アカウントの動作と状態を示すフラグ。
usri22_script_pathLPWSTR8/4+56+40ログオンスクリプトのパス。
usri22_auth_flagsAF_OP4+64+44操作者(管理)権限を示す認可フラグ。
usri22_full_nameLPWSTR8/4+72+48ユーザーのフルネーム。
usri22_usr_commentLPWSTR8/4+80+52ユーザー自身が設定するコメント。
usri22_parmsLPWSTR8/4+88+56アプリケーション固有のパラメータ領域。
usri22_workstationsLPWSTR8/4+96+60ログオンを許可するワークステーション一覧(カンマ区切り)。
usri22_last_logonDWORD4+104+64最後にログオンした日時(1970年起算秒)。
usri22_last_logoffDWORD4+108+68最後にログオフした日時(1970年起算秒)。
usri22_acct_expiresDWORD4+112+72アカウント有効期限(秒)。TIMEQ_FOREVERで無期限。
usri22_max_storageDWORD4+116+76ユーザーに許可される最大ディスク容量(バイト)。
usri22_units_per_weekDWORD4+120+80ログオン時間を表す週あたりの単位数。
usri22_logon_hoursBYTE*8/4+128+84ログオン可能時間帯を表すビットマップへのポインタ。
usri22_bad_pw_countDWORD4+136+88誤ったパスワード入力の回数。
usri22_num_logonsDWORD4+140+92このアカウントの累計ログオン回数。
usri22_logon_serverLPWSTR8/4+144+96ログオンを処理するサーバー名。
usri22_country_codeDWORD4+152+100ユーザーの国コード。
usri22_code_pageDWORD4+156+104ユーザーのコードページ。

各言語での定義

#include <windows.h>

// USER_INFO_22  (x64 160 / x86 108 バイト)
typedef struct USER_INFO_22 {
    LPWSTR usri22_name;
    BYTE usri22_password[16];
    DWORD usri22_password_age;
    USER_PRIV usri22_priv;
    LPWSTR usri22_home_dir;
    LPWSTR usri22_comment;
    USER_ACCOUNT_FLAGS usri22_flags;
    LPWSTR usri22_script_path;
    AF_OP usri22_auth_flags;
    LPWSTR usri22_full_name;
    LPWSTR usri22_usr_comment;
    LPWSTR usri22_parms;
    LPWSTR usri22_workstations;
    DWORD usri22_last_logon;
    DWORD usri22_last_logoff;
    DWORD usri22_acct_expires;
    DWORD usri22_max_storage;
    DWORD usri22_units_per_week;
    BYTE* usri22_logon_hours;
    DWORD usri22_bad_pw_count;
    DWORD usri22_num_logons;
    LPWSTR usri22_logon_server;
    DWORD usri22_country_code;
    DWORD usri22_code_page;
} USER_INFO_22;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct USER_INFO_22
{
    public IntPtr usri22_name;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] public byte[] usri22_password;
    public uint usri22_password_age;
    public uint usri22_priv;
    public IntPtr usri22_home_dir;
    public IntPtr usri22_comment;
    public uint usri22_flags;
    public IntPtr usri22_script_path;
    public uint usri22_auth_flags;
    public IntPtr usri22_full_name;
    public IntPtr usri22_usr_comment;
    public IntPtr usri22_parms;
    public IntPtr usri22_workstations;
    public uint usri22_last_logon;
    public uint usri22_last_logoff;
    public uint usri22_acct_expires;
    public uint usri22_max_storage;
    public uint usri22_units_per_week;
    public IntPtr usri22_logon_hours;
    public uint usri22_bad_pw_count;
    public uint usri22_num_logons;
    public IntPtr usri22_logon_server;
    public uint usri22_country_code;
    public uint usri22_code_page;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure USER_INFO_22
    Public usri22_name As IntPtr
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=16)> Public usri22_password() As Byte
    Public usri22_password_age As UInteger
    Public usri22_priv As UInteger
    Public usri22_home_dir As IntPtr
    Public usri22_comment As IntPtr
    Public usri22_flags As UInteger
    Public usri22_script_path As IntPtr
    Public usri22_auth_flags As UInteger
    Public usri22_full_name As IntPtr
    Public usri22_usr_comment As IntPtr
    Public usri22_parms As IntPtr
    Public usri22_workstations As IntPtr
    Public usri22_last_logon As UInteger
    Public usri22_last_logoff As UInteger
    Public usri22_acct_expires As UInteger
    Public usri22_max_storage As UInteger
    Public usri22_units_per_week As UInteger
    Public usri22_logon_hours As IntPtr
    Public usri22_bad_pw_count As UInteger
    Public usri22_num_logons As UInteger
    Public usri22_logon_server As IntPtr
    Public usri22_country_code As UInteger
    Public usri22_code_page As UInteger
End Structure
import ctypes
from ctypes import wintypes

class USER_INFO_22(ctypes.Structure):
    _fields_ = [
        ("usri22_name", ctypes.c_void_p),
        ("usri22_password", ctypes.c_ubyte * 16),
        ("usri22_password_age", wintypes.DWORD),
        ("usri22_priv", wintypes.DWORD),
        ("usri22_home_dir", ctypes.c_void_p),
        ("usri22_comment", ctypes.c_void_p),
        ("usri22_flags", wintypes.DWORD),
        ("usri22_script_path", ctypes.c_void_p),
        ("usri22_auth_flags", wintypes.DWORD),
        ("usri22_full_name", ctypes.c_void_p),
        ("usri22_usr_comment", ctypes.c_void_p),
        ("usri22_parms", ctypes.c_void_p),
        ("usri22_workstations", ctypes.c_void_p),
        ("usri22_last_logon", wintypes.DWORD),
        ("usri22_last_logoff", wintypes.DWORD),
        ("usri22_acct_expires", wintypes.DWORD),
        ("usri22_max_storage", wintypes.DWORD),
        ("usri22_units_per_week", wintypes.DWORD),
        ("usri22_logon_hours", ctypes.c_void_p),
        ("usri22_bad_pw_count", wintypes.DWORD),
        ("usri22_num_logons", wintypes.DWORD),
        ("usri22_logon_server", ctypes.c_void_p),
        ("usri22_country_code", wintypes.DWORD),
        ("usri22_code_page", wintypes.DWORD),
    ]
#[repr(C)]
pub struct USER_INFO_22 {
    pub usri22_name: *mut core::ffi::c_void,
    pub usri22_password: [u8; 16],
    pub usri22_password_age: u32,
    pub usri22_priv: u32,
    pub usri22_home_dir: *mut core::ffi::c_void,
    pub usri22_comment: *mut core::ffi::c_void,
    pub usri22_flags: u32,
    pub usri22_script_path: *mut core::ffi::c_void,
    pub usri22_auth_flags: u32,
    pub usri22_full_name: *mut core::ffi::c_void,
    pub usri22_usr_comment: *mut core::ffi::c_void,
    pub usri22_parms: *mut core::ffi::c_void,
    pub usri22_workstations: *mut core::ffi::c_void,
    pub usri22_last_logon: u32,
    pub usri22_last_logoff: u32,
    pub usri22_acct_expires: u32,
    pub usri22_max_storage: u32,
    pub usri22_units_per_week: u32,
    pub usri22_logon_hours: *mut core::ffi::c_void,
    pub usri22_bad_pw_count: u32,
    pub usri22_num_logons: u32,
    pub usri22_logon_server: *mut core::ffi::c_void,
    pub usri22_country_code: u32,
    pub usri22_code_page: u32,
}
import "golang.org/x/sys/windows"

type USER_INFO_22 struct {
	usri22_name uintptr
	usri22_password [16]byte
	usri22_password_age uint32
	usri22_priv uint32
	usri22_home_dir uintptr
	usri22_comment uintptr
	usri22_flags uint32
	usri22_script_path uintptr
	usri22_auth_flags uint32
	usri22_full_name uintptr
	usri22_usr_comment uintptr
	usri22_parms uintptr
	usri22_workstations uintptr
	usri22_last_logon uint32
	usri22_last_logoff uint32
	usri22_acct_expires uint32
	usri22_max_storage uint32
	usri22_units_per_week uint32
	usri22_logon_hours uintptr
	usri22_bad_pw_count uint32
	usri22_num_logons uint32
	usri22_logon_server uintptr
	usri22_country_code uint32
	usri22_code_page uint32
}
type
  USER_INFO_22 = record
    usri22_name: Pointer;
    usri22_password: array[0..15] of Byte;
    usri22_password_age: DWORD;
    usri22_priv: DWORD;
    usri22_home_dir: Pointer;
    usri22_comment: Pointer;
    usri22_flags: DWORD;
    usri22_script_path: Pointer;
    usri22_auth_flags: DWORD;
    usri22_full_name: Pointer;
    usri22_usr_comment: Pointer;
    usri22_parms: Pointer;
    usri22_workstations: Pointer;
    usri22_last_logon: DWORD;
    usri22_last_logoff: DWORD;
    usri22_acct_expires: DWORD;
    usri22_max_storage: DWORD;
    usri22_units_per_week: DWORD;
    usri22_logon_hours: Pointer;
    usri22_bad_pw_count: DWORD;
    usri22_num_logons: DWORD;
    usri22_logon_server: Pointer;
    usri22_country_code: DWORD;
    usri22_code_page: DWORD;
  end;
const USER_INFO_22 = extern struct {
    usri22_name: ?*anyopaque,
    usri22_password: [16]u8,
    usri22_password_age: u32,
    usri22_priv: u32,
    usri22_home_dir: ?*anyopaque,
    usri22_comment: ?*anyopaque,
    usri22_flags: u32,
    usri22_script_path: ?*anyopaque,
    usri22_auth_flags: u32,
    usri22_full_name: ?*anyopaque,
    usri22_usr_comment: ?*anyopaque,
    usri22_parms: ?*anyopaque,
    usri22_workstations: ?*anyopaque,
    usri22_last_logon: u32,
    usri22_last_logoff: u32,
    usri22_acct_expires: u32,
    usri22_max_storage: u32,
    usri22_units_per_week: u32,
    usri22_logon_hours: ?*anyopaque,
    usri22_bad_pw_count: u32,
    usri22_num_logons: u32,
    usri22_logon_server: ?*anyopaque,
    usri22_country_code: u32,
    usri22_code_page: u32,
};
type
  USER_INFO_22 {.bycopy.} = object
    usri22_name: pointer
    usri22_password: array[16, uint8]
    usri22_password_age: uint32
    usri22_priv: uint32
    usri22_home_dir: pointer
    usri22_comment: pointer
    usri22_flags: uint32
    usri22_script_path: pointer
    usri22_auth_flags: uint32
    usri22_full_name: pointer
    usri22_usr_comment: pointer
    usri22_parms: pointer
    usri22_workstations: pointer
    usri22_last_logon: uint32
    usri22_last_logoff: uint32
    usri22_acct_expires: uint32
    usri22_max_storage: uint32
    usri22_units_per_week: uint32
    usri22_logon_hours: pointer
    usri22_bad_pw_count: uint32
    usri22_num_logons: uint32
    usri22_logon_server: pointer
    usri22_country_code: uint32
    usri22_code_page: uint32
struct USER_INFO_22
{
    void* usri22_name;
    ubyte[16] usri22_password;
    uint usri22_password_age;
    uint usri22_priv;
    void* usri22_home_dir;
    void* usri22_comment;
    uint usri22_flags;
    void* usri22_script_path;
    uint usri22_auth_flags;
    void* usri22_full_name;
    void* usri22_usr_comment;
    void* usri22_parms;
    void* usri22_workstations;
    uint usri22_last_logon;
    uint usri22_last_logoff;
    uint usri22_acct_expires;
    uint usri22_max_storage;
    uint usri22_units_per_week;
    void* usri22_logon_hours;
    uint usri22_bad_pw_count;
    uint usri22_num_logons;
    void* usri22_logon_server;
    uint usri22_country_code;
    uint usri22_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_22 サイズ: 108 バイト(x86)
dim st, 27    ; 4byte整数×27(構造体サイズ 108 / 4 切り上げ)
; usri22_name : LPWSTR (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; usri22_password : BYTE (+4, 16byte)  varptr(st)+4 を基点に操作(16byte:入れ子/配列)
; usri22_password_age : DWORD (+20, 4byte)  st.5 = 値  /  値 = st.5   (lpoke/lpeek も可)
; usri22_priv : USER_PRIV (+24, 4byte)  st.6 = 値  /  値 = st.6   (lpoke/lpeek も可)
; usri22_home_dir : LPWSTR (+28, 4byte)  st.7 = 値  /  値 = st.7   (lpoke/lpeek も可)
; usri22_comment : LPWSTR (+32, 4byte)  st.8 = 値  /  値 = st.8   (lpoke/lpeek も可)
; usri22_flags : USER_ACCOUNT_FLAGS (+36, 4byte)  st.9 = 値  /  値 = st.9   (lpoke/lpeek も可)
; usri22_script_path : LPWSTR (+40, 4byte)  st.10 = 値  /  値 = st.10   (lpoke/lpeek も可)
; usri22_auth_flags : AF_OP (+44, 4byte)  st.11 = 値  /  値 = st.11   (lpoke/lpeek も可)
; usri22_full_name : LPWSTR (+48, 4byte)  st.12 = 値  /  値 = st.12   (lpoke/lpeek も可)
; usri22_usr_comment : LPWSTR (+52, 4byte)  st.13 = 値  /  値 = st.13   (lpoke/lpeek も可)
; usri22_parms : LPWSTR (+56, 4byte)  st.14 = 値  /  値 = st.14   (lpoke/lpeek も可)
; usri22_workstations : LPWSTR (+60, 4byte)  st.15 = 値  /  値 = st.15   (lpoke/lpeek も可)
; usri22_last_logon : DWORD (+64, 4byte)  st.16 = 値  /  値 = st.16   (lpoke/lpeek も可)
; usri22_last_logoff : DWORD (+68, 4byte)  st.17 = 値  /  値 = st.17   (lpoke/lpeek も可)
; usri22_acct_expires : DWORD (+72, 4byte)  st.18 = 値  /  値 = st.18   (lpoke/lpeek も可)
; usri22_max_storage : DWORD (+76, 4byte)  st.19 = 値  /  値 = st.19   (lpoke/lpeek も可)
; usri22_units_per_week : DWORD (+80, 4byte)  st.20 = 値  /  値 = st.20   (lpoke/lpeek も可)
; usri22_logon_hours : BYTE* (+84, 4byte)  st.21 = 値  /  値 = st.21   (lpoke/lpeek も可)
; usri22_bad_pw_count : DWORD (+88, 4byte)  st.22 = 値  /  値 = st.22   (lpoke/lpeek も可)
; usri22_num_logons : DWORD (+92, 4byte)  st.23 = 値  /  値 = st.23   (lpoke/lpeek も可)
; usri22_logon_server : LPWSTR (+96, 4byte)  st.24 = 値  /  値 = st.24   (lpoke/lpeek も可)
; usri22_country_code : DWORD (+100, 4byte)  st.25 = 値  /  値 = st.25   (lpoke/lpeek も可)
; usri22_code_page : DWORD (+104, 4byte)  st.26 = 値  /  値 = st.26   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; USER_INFO_22 サイズ: 160 バイト(x64)
dim st, 40    ; 4byte整数×40(構造体サイズ 160 / 4 切り上げ)
; usri22_name : LPWSTR (+0, 8byte)  qpoke st,0,値 / qpeek(st,0)  ※IronHSPのみ。3.7/3.8は lpoke st,0,下位 : lpoke st,4,上位
; usri22_password : BYTE (+8, 16byte)  varptr(st)+8 を基点に操作(16byte:入れ子/配列)
; usri22_password_age : DWORD (+24, 4byte)  st.6 = 値  /  値 = st.6   (lpoke/lpeek も可)
; usri22_priv : USER_PRIV (+28, 4byte)  st.7 = 値  /  値 = st.7   (lpoke/lpeek も可)
; usri22_home_dir : LPWSTR (+32, 8byte)  qpoke st,32,値 / qpeek(st,32)  ※IronHSPのみ。3.7/3.8は lpoke st,32,下位 : lpoke st,36,上位
; usri22_comment : LPWSTR (+40, 8byte)  qpoke st,40,値 / qpeek(st,40)  ※IronHSPのみ。3.7/3.8は lpoke st,40,下位 : lpoke st,44,上位
; usri22_flags : USER_ACCOUNT_FLAGS (+48, 4byte)  st.12 = 値  /  値 = st.12   (lpoke/lpeek も可)
; usri22_script_path : LPWSTR (+56, 8byte)  qpoke st,56,値 / qpeek(st,56)  ※IronHSPのみ。3.7/3.8は lpoke st,56,下位 : lpoke st,60,上位
; usri22_auth_flags : AF_OP (+64, 4byte)  st.16 = 値  /  値 = st.16   (lpoke/lpeek も可)
; usri22_full_name : LPWSTR (+72, 8byte)  qpoke st,72,値 / qpeek(st,72)  ※IronHSPのみ。3.7/3.8は lpoke st,72,下位 : lpoke st,76,上位
; usri22_usr_comment : LPWSTR (+80, 8byte)  qpoke st,80,値 / qpeek(st,80)  ※IronHSPのみ。3.7/3.8は lpoke st,80,下位 : lpoke st,84,上位
; usri22_parms : LPWSTR (+88, 8byte)  qpoke st,88,値 / qpeek(st,88)  ※IronHSPのみ。3.7/3.8は lpoke st,88,下位 : lpoke st,92,上位
; usri22_workstations : LPWSTR (+96, 8byte)  qpoke st,96,値 / qpeek(st,96)  ※IronHSPのみ。3.7/3.8は lpoke st,96,下位 : lpoke st,100,上位
; usri22_last_logon : DWORD (+104, 4byte)  st.26 = 値  /  値 = st.26   (lpoke/lpeek も可)
; usri22_last_logoff : DWORD (+108, 4byte)  st.27 = 値  /  値 = st.27   (lpoke/lpeek も可)
; usri22_acct_expires : DWORD (+112, 4byte)  st.28 = 値  /  値 = st.28   (lpoke/lpeek も可)
; usri22_max_storage : DWORD (+116, 4byte)  st.29 = 値  /  値 = st.29   (lpoke/lpeek も可)
; usri22_units_per_week : DWORD (+120, 4byte)  st.30 = 値  /  値 = st.30   (lpoke/lpeek も可)
; usri22_logon_hours : BYTE* (+128, 8byte)  qpoke st,128,値 / qpeek(st,128)  ※IronHSPのみ。3.7/3.8は lpoke st,128,下位 : lpoke st,132,上位
; usri22_bad_pw_count : DWORD (+136, 4byte)  st.34 = 値  /  値 = st.34   (lpoke/lpeek も可)
; usri22_num_logons : DWORD (+140, 4byte)  st.35 = 値  /  値 = st.35   (lpoke/lpeek も可)
; usri22_logon_server : LPWSTR (+144, 8byte)  qpoke st,144,値 / qpeek(st,144)  ※IronHSPのみ。3.7/3.8は lpoke st,144,下位 : lpoke st,148,上位
; usri22_country_code : DWORD (+152, 4byte)  st.38 = 値  /  値 = st.38   (lpoke/lpeek も可)
; usri22_code_page : DWORD (+156, 4byte)  st.39 = 値  /  値 = st.39   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global USER_INFO_22
    #field intptr usri22_name
    #field byte usri22_password 16
    #field int usri22_password_age
    #field int usri22_priv
    #field intptr usri22_home_dir
    #field intptr usri22_comment
    #field int usri22_flags
    #field intptr usri22_script_path
    #field int usri22_auth_flags
    #field intptr usri22_full_name
    #field intptr usri22_usr_comment
    #field intptr usri22_parms
    #field intptr usri22_workstations
    #field int usri22_last_logon
    #field int usri22_last_logoff
    #field int usri22_acct_expires
    #field int usri22_max_storage
    #field int usri22_units_per_week
    #field intptr usri22_logon_hours
    #field int usri22_bad_pw_count
    #field int usri22_num_logons
    #field intptr usri22_logon_server
    #field int usri22_country_code
    #field int usri22_code_page
#endstruct

stdim st, USER_INFO_22        ; NSTRUCT 変数を確保
st->usri22_password_age = 100
mes "usri22_password_age=" + st->usri22_password_age