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

USER_INFO_20

構造体
サイズx64: 32 バイト / x86: 20 バイト

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

フィールド

フィールドサイズx64x86説明
usri20_nameLPWSTR8/4+0+0ユーザーアカウント名。
usri20_full_nameLPWSTR8/4+8+4ユーザーのフルネーム。
usri20_commentLPWSTR8/4+16+8アカウントのコメント。
usri20_flagsUSER_ACCOUNT_FLAGS4+24+12アカウントの動作と状態を示すフラグ。
usri20_user_idDWORD4+28+16ユーザーの相対識別子(RID)。

各言語での定義

#include <windows.h>

// USER_INFO_20  (x64 32 / x86 20 バイト)
typedef struct USER_INFO_20 {
    LPWSTR usri20_name;
    LPWSTR usri20_full_name;
    LPWSTR usri20_comment;
    USER_ACCOUNT_FLAGS usri20_flags;
    DWORD usri20_user_id;
} USER_INFO_20;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct USER_INFO_20
{
    public IntPtr usri20_name;
    public IntPtr usri20_full_name;
    public IntPtr usri20_comment;
    public uint usri20_flags;
    public uint usri20_user_id;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure USER_INFO_20
    Public usri20_name As IntPtr
    Public usri20_full_name As IntPtr
    Public usri20_comment As IntPtr
    Public usri20_flags As UInteger
    Public usri20_user_id As UInteger
End Structure
import ctypes
from ctypes import wintypes

class USER_INFO_20(ctypes.Structure):
    _fields_ = [
        ("usri20_name", ctypes.c_void_p),
        ("usri20_full_name", ctypes.c_void_p),
        ("usri20_comment", ctypes.c_void_p),
        ("usri20_flags", wintypes.DWORD),
        ("usri20_user_id", wintypes.DWORD),
    ]
#[repr(C)]
pub struct USER_INFO_20 {
    pub usri20_name: *mut core::ffi::c_void,
    pub usri20_full_name: *mut core::ffi::c_void,
    pub usri20_comment: *mut core::ffi::c_void,
    pub usri20_flags: u32,
    pub usri20_user_id: u32,
}
import "golang.org/x/sys/windows"

type USER_INFO_20 struct {
	usri20_name uintptr
	usri20_full_name uintptr
	usri20_comment uintptr
	usri20_flags uint32
	usri20_user_id uint32
}
type
  USER_INFO_20 = record
    usri20_name: Pointer;
    usri20_full_name: Pointer;
    usri20_comment: Pointer;
    usri20_flags: DWORD;
    usri20_user_id: DWORD;
  end;
const USER_INFO_20 = extern struct {
    usri20_name: ?*anyopaque,
    usri20_full_name: ?*anyopaque,
    usri20_comment: ?*anyopaque,
    usri20_flags: u32,
    usri20_user_id: u32,
};
type
  USER_INFO_20 {.bycopy.} = object
    usri20_name: pointer
    usri20_full_name: pointer
    usri20_comment: pointer
    usri20_flags: uint32
    usri20_user_id: uint32
struct USER_INFO_20
{
    void* usri20_name;
    void* usri20_full_name;
    void* usri20_comment;
    uint usri20_flags;
    uint usri20_user_id;
}

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_20 サイズ: 20 バイト(x86)
dim st, 5    ; 4byte整数×5(構造体サイズ 20 / 4 切り上げ)
; usri20_name : LPWSTR (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; usri20_full_name : LPWSTR (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; usri20_comment : LPWSTR (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; usri20_flags : USER_ACCOUNT_FLAGS (+12, 4byte)  st.3 = 値  /  値 = st.3   (lpoke/lpeek も可)
; usri20_user_id : DWORD (+16, 4byte)  st.4 = 値  /  値 = st.4   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; USER_INFO_20 サイズ: 32 バイト(x64)
dim st, 8    ; 4byte整数×8(構造体サイズ 32 / 4 切り上げ)
; usri20_name : LPWSTR (+0, 8byte)  qpoke st,0,値 / qpeek(st,0)  ※IronHSPのみ。3.7/3.8は lpoke st,0,下位 : lpoke st,4,上位
; usri20_full_name : LPWSTR (+8, 8byte)  qpoke st,8,値 / qpeek(st,8)  ※IronHSPのみ。3.7/3.8は lpoke st,8,下位 : lpoke st,12,上位
; usri20_comment : LPWSTR (+16, 8byte)  qpoke st,16,値 / qpeek(st,16)  ※IronHSPのみ。3.7/3.8は lpoke st,16,下位 : lpoke st,20,上位
; usri20_flags : USER_ACCOUNT_FLAGS (+24, 4byte)  st.6 = 値  /  値 = st.6   (lpoke/lpeek も可)
; usri20_user_id : DWORD (+28, 4byte)  st.7 = 値  /  値 = st.7   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global USER_INFO_20
    #field intptr usri20_name
    #field intptr usri20_full_name
    #field intptr usri20_comment
    #field int usri20_flags
    #field int usri20_user_id
#endstruct

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