USER_INFO_2
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 | ||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| usri2_name | LPWSTR | 8/4 | +0 | +0 | ユーザー アカウントの名前を指定する Unicode 文字列へのポインターです。 NetUserSetInfo 関数の呼び出しでは、このメンバーは無視されます。詳細については、後述の「解説」セクションを参照してください。 | ||||||||||||||||||||||||||||||||
| usri2_password | LPWSTR | 8/4 | +8 | +4 | usri2_name メンバーで識別されるユーザーのパスワードを指定する Unicode 文字列へのポインターです。長さは PWLEN バイトを超えることはできません。 NetUserEnum 関数および NetUserGetInfo 関数は、パスワードのセキュリティを保つために NULL ポインターを返します。 慣例により、パスワードの長さは LM20_PWLEN 文字までに制限されます。 | ||||||||||||||||||||||||||||||||
| usri2_password_age | DWORD | 4 | +16 | +8 | usri2_password メンバーが最後に変更されてから経過した秒数です。 NetUserAdd 関数および NetUserSetInfo 関数は、このメンバーを無視します。 | ||||||||||||||||||||||||||||||||
| usri2_priv | USER_PRIV | 4 | +20 | +12 | usri2_name メンバーに割り当てられた特権のレベルです。 NetUserAdd 関数を呼び出す場合、このメンバーは USER_PRIV_USER でなければなりません。 NetUserSetInfo 関数の場合、このメンバーは NetUserGetInfo 関数または NetUserEnum 関数から返された値でなければなりません。このメンバーには次のいずれかの値を指定できます。ユーザーおよびグループ アカウントの権利の詳細については、 Privileges を参照してください。
| ||||||||||||||||||||||||||||||||
| usri2_home_dir | LPWSTR | 8/4 | +24 | +16 | usri2_name メンバーで指定されたユーザーのホーム ディレクトリのパスを指定する Unicode 文字列へのポインターです。この文字列は NULL でもかまいません。 | ||||||||||||||||||||||||||||||||
| usri2_comment | LPWSTR | 8/4 | +32 | +20 | ユーザー アカウントに関連付けるコメントを格納する Unicode 文字列へのポインターです。この文字列は NULL 文字列でもよく、終端の null 文字の前に任意の数の文字を含めることもできます。 | ||||||||||||||||||||||||||||||||
| usri2_flags | USER_ACCOUNT_FLAGS | 4 | +40 | +24 | このメンバーには、次の値の 1 つ以上を指定できます。 ユーザー アカウント制御フラグの設定には、特定の 特権 および 制御アクセス権 が必要になる場合があることに注意してください。詳細については、NetUserSetInfo 関数の「解説」セクションを参照してください。
次の値はアカウントの種類を示します。設定できる値は 1 つだけです。 NetUserSetInfo 関数を使用してアカウントの種類を変更することはできません。 | ||||||||||||||||||||||||||||||||
| usri2_script_path | LPWSTR | 8/4 | +48 | +28 | ユーザーのログオン スクリプト ファイルのパスを指定する Unicode 文字列へのポインターです。スクリプト ファイルには、.CMD ファイル、.EXE ファイル、または .BAT ファイルを指定できます。この文字列は NULL にすることもできます。 | ||||||||||||||||||||||||||||||||
| usri2_auth_flags | AF_OP | 4 | +56 | +32 | ユーザーのオペレーター特権です。 NetUserGetInfo 関数および NetUserEnum 関数の呼び出しは、ユーザーのローカル グループのメンバーシップに基づく値を返します。ユーザーが Print Operators のメンバーである場合は AF_OP_PRINT が設定されます。ユーザーが Server Operators のメンバーである場合は AF_OP_SERVER が設定されます。ユーザーが Account Operators のメンバーである場合は AF_OP_ACCOUNTS が設定されます。AF_OP_COMM が設定されることはありません。ユーザーおよびグループ アカウントの権利の詳細については、 Privileges を参照してください。 次の制限が適用されます。
| ||||||||||||||||||||||||||||||||
| usri2_full_name | LPWSTR | 8/4 | +64 | +36 | ユーザーのフル ネームを格納する Unicode 文字列へのポインターです。この文字列は NULL 文字列でもよく、終端の null 文字の前に任意の数の文字を含めることもできます。 | ||||||||||||||||||||||||||||||||
| usri2_usr_comment | LPWSTR | 8/4 | +72 | +40 | ユーザー コメントを格納する Unicode 文字列へのポインターです。この文字列は NULL 文字列でもよく、終端の null 文字の前に任意の数の文字を含めることもできます。 | ||||||||||||||||||||||||||||||||
| usri2_parms | LPWSTR | 8/4 | +80 | +44 | アプリケーションが使用するために予約済みの Unicode 文字列へのポインターです。この文字列は NULL 文字列でもよく、終端の null 文字の前に任意の数の文字を含めることもできます。Microsoft 製品は、このメンバーを使用してユーザー構成情報を格納します。この情報は変更しないでください。 | ||||||||||||||||||||||||||||||||
| usri2_workstations | LPWSTR | 8/4 | +88 | +48 | 重要
usri2_workstations は今後使用しないでください。代わりに、ユーザー権利の割り当ての設定 (ローカル ログオンを許可する と ローカル ログオンを拒否する、または リモート デスクトップ サービスを使用したログオンを許可する と リモート デスクトップ サービスを使用したログオンを拒否する) を構成することで、ワークステーションへのサインイン アクセスを制御できます。 ユーザーがログオンできるワークステーションの名前を格納する Unicode 文字列へのポインターです。最大 8 台のワークステーションを指定でき、名前はコンマで区切る必要があります。NULL 文字列は制限がないことを示します。このアカウントに対してすべてのワークステーションからのログオンを無効にするには、usri2_flags メンバーに UF_ACCOUNTDISABLE 値を設定します。 | ||||||||||||||||||||||||||||||||
| usri2_last_logon | DWORD | 4 | +96 | +52 | 最後のログオンが行われた日時です。この値は、1970 年 1 月 1 日 00:00:00 (GMT) から経過した秒数として格納されます。このメンバーは NetUserAdd 関数および NetUserSetInfo 関数では無視されます。 このメンバーは、ドメイン内の各バックアップ ドメイン コントローラー (BDC) で個別に保持されます。正確な値を取得するには、ドメイン内の各 BDC に問い合わせる必要があります。最後のログオンは、取得した値のうち最も大きい値が示す時刻に行われています。 | ||||||||||||||||||||||||||||||||
| usri2_last_logoff | DWORD | 4 | +100 | +56 | このメンバーは現在使用されていません。 最後のログオフが行われた時刻を示します。この値は、1970 年 1 月 1 日 00:00:00 (GMT) から経過した秒数として格納されます。値が 0 の場合は、最後のログオフ時刻が不明であることを示します。 このメンバーは、ドメイン内の各バックアップ ドメイン コントローラー (BDC) で個別に保持されます。正確な値を取得するには、ドメイン内の各 BDC に問い合わせる必要があります。最後のログオフは、取得した値のうち最も大きい値が示す時刻に行われています。 | ||||||||||||||||||||||||||||||||
| usri2_acct_expires | DWORD | 4 | +104 | +60 | アカウントの有効期限が切れる日時です。この値は、1970 年 1 月 1 日 00:00:00 (GMT) から経過した秒数として格納されます。TIMEQ_FOREVER の値は、アカウントの有効期限が切れないことを示します。 | ||||||||||||||||||||||||||||||||
| usri2_max_storage | DWORD | 4 | +108 | +64 | ユーザーが使用できるディスク領域の最大量です。使用可能なすべてのディスク領域を使用するには、USER_MAXSTORAGE_UNLIMITED を指定します。 | ||||||||||||||||||||||||||||||||
| usri2_units_per_week | DWORD | 4 | +112 | +68 | 1 週間を分割する、等しい長さの時間単位の数です。この値は、usri2_logon_hours メンバーのビット文字列の長さを計算するために必要です。 LAN Manager 2.0 の場合、この値は UNITS_PER_WEEK でなければなりません。この要素は NetUserAdd 関数および NetUserSetInfo 関数では無視されます。 サービス アプリケーションの場合、単位は SAM_DAYS_PER_WEEK、SAM_HOURS_PER_WEEK、SAM_MINUTES_PER_WEEK のいずれかでなければなりません。 | ||||||||||||||||||||||||||||||||
| usri2_logon_hours | BYTE* | 8/4 | +120 | +72 | ユーザーがログオンできる時間帯を指定する 21 バイト (168 ビット) のビット文字列へのポインターです。各ビットは、グリニッジ標準時 (GMT) における 1 週間の各時間に対応します。 最初のビット (ワード 0 のビット 0) は日曜日の 0:00 から 0:59、2 番目のビット (ワード 0 のビット 1) は日曜日の 1:00 から 1:59、というように続きます。ワード 0 のビット 0 が日曜日の 0:00 から 0:59 を表すのは、GMT のタイム ゾーンにいる場合だけである点に注意してください。それ以外の場合は、タイム ゾーンのオフセット (たとえば太平洋標準時では GMT マイナス 8 時間) に応じてビットを調整する必要があります。 時間の制限がないことを示すには、 NetUserAdd 関数を呼び出すときに、このメンバーに NULL ポインターを指定します。ユーザーがログオンできる時間帯を変更しないことを示すには、 NetUserSetInfo 関数を呼び出すときに NULL ポインターを指定します。 | ||||||||||||||||||||||||||||||||
| usri2_bad_pw_count | DWORD | 4 | +128 | +76 | ユーザーが誤ったパスワードを使用してアカウントへのログオンを試みた回数です。値が – 1 の場合は、値が不明であることを示します。 NetUserAdd 関数および NetUserSetInfo 関数の呼び出しでは、このメンバーは無視されます。 このメンバーはプライマリ ドメイン コントローラー (PDC) から複製され、ドメイン内の各バックアップ ドメイン コントローラー (BDC) でも保持されます。正確な値を取得するには、ドメイン内の各 BDC に問い合わせる必要があります。ユーザーが誤ったパスワードでログオンを試みた回数は、取得した値のうち最も大きい値になります。 | ||||||||||||||||||||||||||||||||
| usri2_num_logons | DWORD | 4 | +132 | +80 | ユーザーがこのアカウントへのログオンに成功した回数です。値が – 1 の場合は、値が不明であることを示します。 NetUserAdd 関数および NetUserSetInfo 関数の呼び出しでは、このメンバーは無視されます。 このメンバーは、ドメイン内の各バックアップ ドメイン コントローラー (BDC) で個別に保持されます。正確な値を取得するには、ドメイン内の各 BDC に問い合わせる必要があります。ユーザーがログオンに成功した回数は、取得した値の合計になります。 | ||||||||||||||||||||||||||||||||
| usri2_logon_server | LPWSTR | 8/4 | +136 | +84 | ログオン要求の送信先となるサーバーの名前を格納する Unicode 文字列へのポインターです。サーバー名の前には 2 つのバックスラッシュ (\) を付ける必要があります。ログオン要求を任意のログオン サーバーが処理できることを示すには、サーバー名としてアスタリスク (\*) を指定します。NULL 文字列は、要求をドメイン コントローラーに送信することを示します。 Windows サーバーの場合、 NetUserGetInfo と NetUserEnum は \* を返します。 NetUserAdd 関数および NetUserSetInfo 関数は、このメンバーを無視します。 | ||||||||||||||||||||||||||||||||
| usri2_country_code | DWORD | 4 | +144 | +88 | ユーザーが選択した言語の国/地域コードです。 | ||||||||||||||||||||||||||||||||
| usri2_code_page | DWORD | 4 | +148 | +92 | ユーザーが選択した言語のコード ページです。 |
公式ドキュメント
USER_INFO_2 構造体は、アカウント名、パスワード データ、特権レベル、ユーザーのホーム ディレクトリへのパス、その他のユーザー関連のネットワーク統計情報など、ユーザー アカウントに関する情報を格納します。
解説(Remarks)
ユーザーおよびグループ アカウントの権利の詳細については、 Privileges を参照してください。
ユーザー アカウント名は 20 文字まで、グループ名は 256 文字までに制限されます。また、アカウント名をピリオドで終えることはできず、コンマや次の印字可能な文字を含めることもできません: ", /, , [, ], :, |, <, >, +, =, ;, ?, *。名前には、印字できない 1 ~ 31 の範囲の文字も含めることはできません。
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)
各言語での定義
#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