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

NET_DISPLAY_MACHINE

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

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

フィールド

フィールドサイズx64x86説明
usri2_nameLPWSTR8/4+0+0コンピューター(マシン)アカウント名を示すUnicode文字列。
usri2_commentLPWSTR8/4+8+4マシンアカウントに付与されたコメントを示すUnicode文字列。
usri2_flagsUSER_ACCOUNT_FLAGS4+16+8アカウントを制御するフラグ。UF_WORKSTATION_TRUST_ACCOUNT等のビットの組み合わせ。
usri2_user_idDWORD4+20+12マシンアカウントの相対識別子(RID)を示す。
usri2_next_indexDWORD4+24+16次の検索開始位置を示すインデックス値。継続列挙時に渡す。

各言語での定義

#include <windows.h>

// NET_DISPLAY_MACHINE  (x64 32 / x86 20 バイト)
typedef struct NET_DISPLAY_MACHINE {
    LPWSTR usri2_name;
    LPWSTR usri2_comment;
    USER_ACCOUNT_FLAGS usri2_flags;
    DWORD usri2_user_id;
    DWORD usri2_next_index;
} NET_DISPLAY_MACHINE;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct NET_DISPLAY_MACHINE
{
    public IntPtr usri2_name;
    public IntPtr usri2_comment;
    public uint usri2_flags;
    public uint usri2_user_id;
    public uint usri2_next_index;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure NET_DISPLAY_MACHINE
    Public usri2_name As IntPtr
    Public usri2_comment As IntPtr
    Public usri2_flags As UInteger
    Public usri2_user_id As UInteger
    Public usri2_next_index As UInteger
End Structure
import ctypes
from ctypes import wintypes

class NET_DISPLAY_MACHINE(ctypes.Structure):
    _fields_ = [
        ("usri2_name", ctypes.c_void_p),
        ("usri2_comment", ctypes.c_void_p),
        ("usri2_flags", wintypes.DWORD),
        ("usri2_user_id", wintypes.DWORD),
        ("usri2_next_index", wintypes.DWORD),
    ]
#[repr(C)]
pub struct NET_DISPLAY_MACHINE {
    pub usri2_name: *mut core::ffi::c_void,
    pub usri2_comment: *mut core::ffi::c_void,
    pub usri2_flags: u32,
    pub usri2_user_id: u32,
    pub usri2_next_index: u32,
}
import "golang.org/x/sys/windows"

type NET_DISPLAY_MACHINE struct {
	usri2_name uintptr
	usri2_comment uintptr
	usri2_flags uint32
	usri2_user_id uint32
	usri2_next_index uint32
}
type
  NET_DISPLAY_MACHINE = record
    usri2_name: Pointer;
    usri2_comment: Pointer;
    usri2_flags: DWORD;
    usri2_user_id: DWORD;
    usri2_next_index: DWORD;
  end;
const NET_DISPLAY_MACHINE = extern struct {
    usri2_name: ?*anyopaque,
    usri2_comment: ?*anyopaque,
    usri2_flags: u32,
    usri2_user_id: u32,
    usri2_next_index: u32,
};
type
  NET_DISPLAY_MACHINE {.bycopy.} = object
    usri2_name: pointer
    usri2_comment: pointer
    usri2_flags: uint32
    usri2_user_id: uint32
    usri2_next_index: uint32
struct NET_DISPLAY_MACHINE
{
    void* usri2_name;
    void* usri2_comment;
    uint usri2_flags;
    uint usri2_user_id;
    uint usri2_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_MACHINE サイズ: 20 バイト(x86)
dim st, 5    ; 4byte整数×5(構造体サイズ 20 / 4 切り上げ)
; usri2_name : LPWSTR (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; usri2_comment : LPWSTR (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; usri2_flags : USER_ACCOUNT_FLAGS (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; usri2_user_id : DWORD (+12, 4byte)  st.3 = 値  /  値 = st.3   (lpoke/lpeek も可)
; usri2_next_index : DWORD (+16, 4byte)  st.4 = 値  /  値 = st.4   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; NET_DISPLAY_MACHINE サイズ: 32 バイト(x64)
dim st, 8    ; 4byte整数×8(構造体サイズ 32 / 4 切り上げ)
; usri2_name : LPWSTR (+0, 8byte)  qpoke st,0,値 / qpeek(st,0)  ※IronHSPのみ。3.7/3.8は lpoke st,0,下位 : lpoke st,4,上位
; usri2_comment : LPWSTR (+8, 8byte)  qpoke st,8,値 / qpeek(st,8)  ※IronHSPのみ。3.7/3.8は lpoke st,8,下位 : lpoke st,12,上位
; usri2_flags : USER_ACCOUNT_FLAGS (+16, 4byte)  st.4 = 値  /  値 = st.4   (lpoke/lpeek も可)
; usri2_user_id : DWORD (+20, 4byte)  st.5 = 値  /  値 = st.5   (lpoke/lpeek も可)
; usri2_next_index : DWORD (+24, 4byte)  st.6 = 値  /  値 = st.6   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global NET_DISPLAY_MACHINE
    #field intptr usri2_name
    #field intptr usri2_comment
    #field int usri2_flags
    #field int usri2_user_id
    #field int usri2_next_index
#endstruct

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