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

USE_INFO_4

構造体
サイズx64: 80 バイト / x86: 48 バイト

サイズ=各フィールドのバイト数(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可。

各言語での定義

#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_4  (x64 80 / x86 48 バイト)
typedef struct USE_INFO_4 {
    USE_INFO_3 ui4_ui3;
    DWORD ui4_auth_identity_length;
    BYTE* ui4_auth_identity;
} USE_INFO_4;
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_4
{
    public USE_INFO_3 ui4_ui3;
    public uint ui4_auth_identity_length;
    public IntPtr ui4_auth_identity;
}
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_4
    Public ui4_ui3 As USE_INFO_3
    Public ui4_auth_identity_length As UInteger
    Public ui4_auth_identity 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_4(ctypes.Structure):
    _fields_ = [
        ("ui4_ui3", USE_INFO_3),
        ("ui4_auth_identity_length", wintypes.DWORD),
        ("ui4_auth_identity", 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_4 {
    pub ui4_ui3: USE_INFO_3,
    pub ui4_auth_identity_length: u32,
    pub ui4_auth_identity: *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_4 struct {
	ui4_ui3 USE_INFO_3
	ui4_auth_identity_length uint32
	ui4_auth_identity 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_4 = record
    ui4_ui3: USE_INFO_3;
    ui4_auth_identity_length: DWORD;
    ui4_auth_identity: 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_4 = extern struct {
    ui4_ui3: USE_INFO_3,
    ui4_auth_identity_length: u32,
    ui4_auth_identity: ?*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_4 {.bycopy.} = object
    ui4_ui3: USE_INFO_3
    ui4_auth_identity_length: uint32
    ui4_auth_identity: 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_4
{
    USE_INFO_3 ui4_ui3;
    uint ui4_auth_identity_length;
    void* ui4_auth_identity;
}

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_4 サイズ: 48 バイト(x86)
dim st, 12    ; 4byte整数×12(構造体サイズ 48 / 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 も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; USE_INFO_4 サイズ: 80 バイト(x64)
dim st, 20    ; 4byte整数×20(構造体サイズ 80 / 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,上位
; ※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_4
    #field USE_INFO_3 ui4_ui3
    #field int ui4_auth_identity_length
    #field intptr ui4_auth_identity
#endstruct

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