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

NET_DISPLAY_USER

構造体
サイズx64: 40 バイト / x86: 24 バイト

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

フィールド

フィールドサイズx64x86説明
usri1_nameLPWSTR8/4+0+0ユーザーアカウント名を示すUnicode文字列。
usri1_commentLPWSTR8/4+8+4ユーザーアカウントに付与されたコメントを示すUnicode文字列。
usri1_flagsUSER_ACCOUNT_FLAGS4+16+8アカウントの操作・構成を制御するフラグ。UF_ACCOUNTDISABLE等のビットの組み合わせ。
usri1_full_nameLPWSTR8/4+24+12ユーザーのフルネーム(氏名)を示すUnicode文字列。
usri1_user_idDWORD4+32+16ユーザーの相対識別子(RID)を示す。アカウントを一意に識別する。
usri1_next_indexDWORD4+36+20次の検索開始位置を示すインデックス値。継続列挙時に渡す。

各言語での定義

#include <windows.h>

// NET_DISPLAY_USER  (x64 40 / x86 24 バイト)
typedef struct NET_DISPLAY_USER {
    LPWSTR usri1_name;
    LPWSTR usri1_comment;
    USER_ACCOUNT_FLAGS usri1_flags;
    LPWSTR usri1_full_name;
    DWORD usri1_user_id;
    DWORD usri1_next_index;
} NET_DISPLAY_USER;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct NET_DISPLAY_USER
{
    public IntPtr usri1_name;
    public IntPtr usri1_comment;
    public uint usri1_flags;
    public IntPtr usri1_full_name;
    public uint usri1_user_id;
    public uint usri1_next_index;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure NET_DISPLAY_USER
    Public usri1_name As IntPtr
    Public usri1_comment As IntPtr
    Public usri1_flags As UInteger
    Public usri1_full_name As IntPtr
    Public usri1_user_id As UInteger
    Public usri1_next_index As UInteger
End Structure
import ctypes
from ctypes import wintypes

class NET_DISPLAY_USER(ctypes.Structure):
    _fields_ = [
        ("usri1_name", ctypes.c_void_p),
        ("usri1_comment", ctypes.c_void_p),
        ("usri1_flags", wintypes.DWORD),
        ("usri1_full_name", ctypes.c_void_p),
        ("usri1_user_id", wintypes.DWORD),
        ("usri1_next_index", wintypes.DWORD),
    ]
#[repr(C)]
pub struct NET_DISPLAY_USER {
    pub usri1_name: *mut core::ffi::c_void,
    pub usri1_comment: *mut core::ffi::c_void,
    pub usri1_flags: u32,
    pub usri1_full_name: *mut core::ffi::c_void,
    pub usri1_user_id: u32,
    pub usri1_next_index: u32,
}
import "golang.org/x/sys/windows"

type NET_DISPLAY_USER struct {
	usri1_name uintptr
	usri1_comment uintptr
	usri1_flags uint32
	usri1_full_name uintptr
	usri1_user_id uint32
	usri1_next_index uint32
}
type
  NET_DISPLAY_USER = record
    usri1_name: Pointer;
    usri1_comment: Pointer;
    usri1_flags: DWORD;
    usri1_full_name: Pointer;
    usri1_user_id: DWORD;
    usri1_next_index: DWORD;
  end;
const NET_DISPLAY_USER = extern struct {
    usri1_name: ?*anyopaque,
    usri1_comment: ?*anyopaque,
    usri1_flags: u32,
    usri1_full_name: ?*anyopaque,
    usri1_user_id: u32,
    usri1_next_index: u32,
};
type
  NET_DISPLAY_USER {.bycopy.} = object
    usri1_name: pointer
    usri1_comment: pointer
    usri1_flags: uint32
    usri1_full_name: pointer
    usri1_user_id: uint32
    usri1_next_index: uint32
struct NET_DISPLAY_USER
{
    void* usri1_name;
    void* usri1_comment;
    uint usri1_flags;
    void* usri1_full_name;
    uint usri1_user_id;
    uint usri1_next_index;
}

HSP用 定義

HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。

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

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