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

USE_INFO_5

構造体
サイズx64: 112 バイト / x86: 64 バイト

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

フィールド

フィールドサイズx64x86説明
ui4_ui3USE_INFO_364/40+0+0フラグ付き接続情報を含むUSE_INFO_3構造体を埋め込む。
ui4_auth_identity_lengthDWORD4+64+40認証識別子データの長さをバイト単位で示す。
ui4_auth_identityBYTE*8/4+72+44資格情報を格納する認証識別子データへのポインタ。NULL可。
ui5_security_descriptor_lengthDWORD4+80+48セキュリティ記述子データの長さをバイト単位で示す。
ui5_security_descriptorBYTE*8/4+88+52接続に適用するセキュリティ記述子(自己相対形式)へのポインタ。NULL可。
ui5_use_options_lengthDWORD4+96+56接続オプションデータの長さをバイト単位で示す。
ui5_use_optionsBYTE*8/4+104+60追加の接続オプション(USE_OPTION_*列)を格納するバッファへのポインタ。

各言語での定義

#include <windows.h>

// USE_INFO_2  (x64 56 / x86 36 バイト)
typedef struct USE_INFO_2 {
    LPWSTR ui2_local;
    LPWSTR ui2_remote;
    LPWSTR ui2_password;
    DWORD ui2_status;
    USE_INFO_ASG_TYPE ui2_asg_type;
    DWORD ui2_refcount;
    DWORD ui2_usecount;
    LPWSTR ui2_username;
    LPWSTR ui2_domainname;
} USE_INFO_2;

// USE_INFO_3  (x64 64 / x86 40 バイト)
typedef struct USE_INFO_3 {
    USE_INFO_2 ui3_ui2;
    DWORD ui3_flags;
} USE_INFO_3;

// USE_INFO_5  (x64 112 / x86 64 バイト)
typedef struct USE_INFO_5 {
    USE_INFO_3 ui4_ui3;
    DWORD ui4_auth_identity_length;
    BYTE* ui4_auth_identity;
    DWORD ui5_security_descriptor_length;
    BYTE* ui5_security_descriptor;
    DWORD ui5_use_options_length;
    BYTE* ui5_use_options;
} USE_INFO_5;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct USE_INFO_2
{
    public IntPtr ui2_local;
    public IntPtr ui2_remote;
    public IntPtr ui2_password;
    public uint ui2_status;
    public uint ui2_asg_type;
    public uint ui2_refcount;
    public uint ui2_usecount;
    public IntPtr ui2_username;
    public IntPtr ui2_domainname;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct USE_INFO_3
{
    public USE_INFO_2 ui3_ui2;
    public uint ui3_flags;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct USE_INFO_5
{
    public USE_INFO_3 ui4_ui3;
    public uint ui4_auth_identity_length;
    public IntPtr ui4_auth_identity;
    public uint ui5_security_descriptor_length;
    public IntPtr ui5_security_descriptor;
    public uint ui5_use_options_length;
    public IntPtr ui5_use_options;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure USE_INFO_2
    Public ui2_local As IntPtr
    Public ui2_remote As IntPtr
    Public ui2_password As IntPtr
    Public ui2_status As UInteger
    Public ui2_asg_type As UInteger
    Public ui2_refcount As UInteger
    Public ui2_usecount As UInteger
    Public ui2_username As IntPtr
    Public ui2_domainname As IntPtr
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure USE_INFO_3
    Public ui3_ui2 As USE_INFO_2
    Public ui3_flags As UInteger
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure USE_INFO_5
    Public ui4_ui3 As USE_INFO_3
    Public ui4_auth_identity_length As UInteger
    Public ui4_auth_identity As IntPtr
    Public ui5_security_descriptor_length As UInteger
    Public ui5_security_descriptor As IntPtr
    Public ui5_use_options_length As UInteger
    Public ui5_use_options As IntPtr
End Structure
import ctypes
from ctypes import wintypes

class USE_INFO_2(ctypes.Structure):
    _fields_ = [
        ("ui2_local", ctypes.c_void_p),
        ("ui2_remote", ctypes.c_void_p),
        ("ui2_password", ctypes.c_void_p),
        ("ui2_status", wintypes.DWORD),
        ("ui2_asg_type", wintypes.DWORD),
        ("ui2_refcount", wintypes.DWORD),
        ("ui2_usecount", wintypes.DWORD),
        ("ui2_username", ctypes.c_void_p),
        ("ui2_domainname", ctypes.c_void_p),
    ]

class USE_INFO_3(ctypes.Structure):
    _fields_ = [
        ("ui3_ui2", USE_INFO_2),
        ("ui3_flags", wintypes.DWORD),
    ]

class USE_INFO_5(ctypes.Structure):
    _fields_ = [
        ("ui4_ui3", USE_INFO_3),
        ("ui4_auth_identity_length", wintypes.DWORD),
        ("ui4_auth_identity", ctypes.c_void_p),
        ("ui5_security_descriptor_length", wintypes.DWORD),
        ("ui5_security_descriptor", ctypes.c_void_p),
        ("ui5_use_options_length", wintypes.DWORD),
        ("ui5_use_options", ctypes.c_void_p),
    ]
#[repr(C)]
pub struct USE_INFO_2 {
    pub ui2_local: *mut core::ffi::c_void,
    pub ui2_remote: *mut core::ffi::c_void,
    pub ui2_password: *mut core::ffi::c_void,
    pub ui2_status: u32,
    pub ui2_asg_type: u32,
    pub ui2_refcount: u32,
    pub ui2_usecount: u32,
    pub ui2_username: *mut core::ffi::c_void,
    pub ui2_domainname: *mut core::ffi::c_void,
}

#[repr(C)]
pub struct USE_INFO_3 {
    pub ui3_ui2: USE_INFO_2,
    pub ui3_flags: u32,
}

#[repr(C)]
pub struct USE_INFO_5 {
    pub ui4_ui3: USE_INFO_3,
    pub ui4_auth_identity_length: u32,
    pub ui4_auth_identity: *mut core::ffi::c_void,
    pub ui5_security_descriptor_length: u32,
    pub ui5_security_descriptor: *mut core::ffi::c_void,
    pub ui5_use_options_length: u32,
    pub ui5_use_options: *mut core::ffi::c_void,
}
import "golang.org/x/sys/windows"

type USE_INFO_2 struct {
	ui2_local uintptr
	ui2_remote uintptr
	ui2_password uintptr
	ui2_status uint32
	ui2_asg_type uint32
	ui2_refcount uint32
	ui2_usecount uint32
	ui2_username uintptr
	ui2_domainname uintptr
}

type USE_INFO_3 struct {
	ui3_ui2 USE_INFO_2
	ui3_flags uint32
}

type USE_INFO_5 struct {
	ui4_ui3 USE_INFO_3
	ui4_auth_identity_length uint32
	ui4_auth_identity uintptr
	ui5_security_descriptor_length uint32
	ui5_security_descriptor uintptr
	ui5_use_options_length uint32
	ui5_use_options uintptr
}
type
  USE_INFO_2 = record
    ui2_local: Pointer;
    ui2_remote: Pointer;
    ui2_password: Pointer;
    ui2_status: DWORD;
    ui2_asg_type: DWORD;
    ui2_refcount: DWORD;
    ui2_usecount: DWORD;
    ui2_username: Pointer;
    ui2_domainname: Pointer;
  end;

  USE_INFO_3 = record
    ui3_ui2: USE_INFO_2;
    ui3_flags: DWORD;
  end;

  USE_INFO_5 = record
    ui4_ui3: USE_INFO_3;
    ui4_auth_identity_length: DWORD;
    ui4_auth_identity: Pointer;
    ui5_security_descriptor_length: DWORD;
    ui5_security_descriptor: Pointer;
    ui5_use_options_length: DWORD;
    ui5_use_options: Pointer;
  end;
const USE_INFO_2 = extern struct {
    ui2_local: ?*anyopaque,
    ui2_remote: ?*anyopaque,
    ui2_password: ?*anyopaque,
    ui2_status: u32,
    ui2_asg_type: u32,
    ui2_refcount: u32,
    ui2_usecount: u32,
    ui2_username: ?*anyopaque,
    ui2_domainname: ?*anyopaque,
};

const USE_INFO_3 = extern struct {
    ui3_ui2: USE_INFO_2,
    ui3_flags: u32,
};

const USE_INFO_5 = extern struct {
    ui4_ui3: USE_INFO_3,
    ui4_auth_identity_length: u32,
    ui4_auth_identity: ?*anyopaque,
    ui5_security_descriptor_length: u32,
    ui5_security_descriptor: ?*anyopaque,
    ui5_use_options_length: u32,
    ui5_use_options: ?*anyopaque,
};
type
  USE_INFO_2 {.bycopy.} = object
    ui2_local: pointer
    ui2_remote: pointer
    ui2_password: pointer
    ui2_status: uint32
    ui2_asg_type: uint32
    ui2_refcount: uint32
    ui2_usecount: uint32
    ui2_username: pointer
    ui2_domainname: pointer

  USE_INFO_3 {.bycopy.} = object
    ui3_ui2: USE_INFO_2
    ui3_flags: uint32

  USE_INFO_5 {.bycopy.} = object
    ui4_ui3: USE_INFO_3
    ui4_auth_identity_length: uint32
    ui4_auth_identity: pointer
    ui5_security_descriptor_length: uint32
    ui5_security_descriptor: pointer
    ui5_use_options_length: uint32
    ui5_use_options: pointer
struct USE_INFO_2
{
    void* ui2_local;
    void* ui2_remote;
    void* ui2_password;
    uint ui2_status;
    uint ui2_asg_type;
    uint ui2_refcount;
    uint ui2_usecount;
    void* ui2_username;
    void* ui2_domainname;
}

struct USE_INFO_3
{
    USE_INFO_2 ui3_ui2;
    uint ui3_flags;
}

struct USE_INFO_5
{
    USE_INFO_3 ui4_ui3;
    uint ui4_auth_identity_length;
    void* ui4_auth_identity;
    uint ui5_security_descriptor_length;
    void* ui5_security_descriptor;
    uint ui5_use_options_length;
    void* ui5_use_options;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; USE_INFO_5 サイズ: 64 バイト(x86)
dim st, 16    ; 4byte整数×16(構造体サイズ 64 / 4 切り上げ)
; ui4_ui3 : USE_INFO_3 (+0, 40byte)  varptr(st)+0 を基点に操作(40byte:入れ子/配列)
; ui4_auth_identity_length : DWORD (+40, 4byte)  st.10 = 値  /  値 = st.10   (lpoke/lpeek も可)
; ui4_auth_identity : BYTE* (+44, 4byte)  st.11 = 値  /  値 = st.11   (lpoke/lpeek も可)
; ui5_security_descriptor_length : DWORD (+48, 4byte)  st.12 = 値  /  値 = st.12   (lpoke/lpeek も可)
; ui5_security_descriptor : BYTE* (+52, 4byte)  st.13 = 値  /  値 = st.13   (lpoke/lpeek も可)
; ui5_use_options_length : DWORD (+56, 4byte)  st.14 = 値  /  値 = st.14   (lpoke/lpeek も可)
; ui5_use_options : BYTE* (+60, 4byte)  st.15 = 値  /  値 = st.15   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; USE_INFO_5 サイズ: 112 バイト(x64)
dim st, 28    ; 4byte整数×28(構造体サイズ 112 / 4 切り上げ)
; ui4_ui3 : USE_INFO_3 (+0, 64byte)  varptr(st)+0 を基点に操作(64byte:入れ子/配列)
; ui4_auth_identity_length : DWORD (+64, 4byte)  st.16 = 値  /  値 = st.16   (lpoke/lpeek も可)
; ui4_auth_identity : BYTE* (+72, 8byte)  qpoke st,72,値 / qpeek(st,72)  ※IronHSPのみ。3.7/3.8は lpoke st,72,下位 : lpoke st,76,上位
; ui5_security_descriptor_length : DWORD (+80, 4byte)  st.20 = 値  /  値 = st.20   (lpoke/lpeek も可)
; ui5_security_descriptor : BYTE* (+88, 8byte)  qpoke st,88,値 / qpeek(st,88)  ※IronHSPのみ。3.7/3.8は lpoke st,88,下位 : lpoke st,92,上位
; ui5_use_options_length : DWORD (+96, 4byte)  st.24 = 値  /  値 = st.24   (lpoke/lpeek も可)
; ui5_use_options : BYTE* (+104, 8byte)  qpoke st,104,値 / qpeek(st,104)  ※IronHSPのみ。3.7/3.8は lpoke st,104,下位 : lpoke st,108,上位
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global USE_INFO_2
    #field intptr ui2_local
    #field intptr ui2_remote
    #field intptr ui2_password
    #field int ui2_status
    #field int ui2_asg_type
    #field int ui2_refcount
    #field int ui2_usecount
    #field intptr ui2_username
    #field intptr ui2_domainname
#endstruct

#defstruct global USE_INFO_3
    #field USE_INFO_2 ui3_ui2
    #field int ui3_flags
#endstruct

#defstruct global USE_INFO_5
    #field USE_INFO_3 ui4_ui3
    #field int ui4_auth_identity_length
    #field intptr ui4_auth_identity
    #field int ui5_security_descriptor_length
    #field intptr ui5_security_descriptor
    #field int ui5_use_options_length
    #field intptr ui5_use_options
#endstruct

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