Win32 API 日本語リファレンス
ホームStorage.FileSystem › CONNECTION_INFO_1

CONNECTION_INFO_1

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

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

フィールド

フィールドサイズx64x86説明
coni1_idDWORD4+0+0接続を一意に識別する接続ID。
coni1_typeSHARE_TYPE4+4+4接続先共有リソースの種類を示すSHARE_TYPE値。
coni1_num_opensDWORD4+8+8この接続で開かれているファイル数。
coni1_num_usersDWORD4+12+12この接続を使用しているユーザー数。
coni1_timeDWORD4+16+16接続が確立されてからの経過秒数。
coni1_usernameLPWSTR8/4+24+20接続を確立したユーザー名。
coni1_netnameLPWSTR8/4+32+24接続先の共有名、または接続元のコンピューター名。

各言語での定義

#include <windows.h>

// CONNECTION_INFO_1  (x64 40 / x86 28 バイト)
typedef struct CONNECTION_INFO_1 {
    DWORD coni1_id;
    SHARE_TYPE coni1_type;
    DWORD coni1_num_opens;
    DWORD coni1_num_users;
    DWORD coni1_time;
    LPWSTR coni1_username;
    LPWSTR coni1_netname;
} CONNECTION_INFO_1;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct CONNECTION_INFO_1
{
    public uint coni1_id;
    public uint coni1_type;
    public uint coni1_num_opens;
    public uint coni1_num_users;
    public uint coni1_time;
    public IntPtr coni1_username;
    public IntPtr coni1_netname;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure CONNECTION_INFO_1
    Public coni1_id As UInteger
    Public coni1_type As UInteger
    Public coni1_num_opens As UInteger
    Public coni1_num_users As UInteger
    Public coni1_time As UInteger
    Public coni1_username As IntPtr
    Public coni1_netname As IntPtr
End Structure
import ctypes
from ctypes import wintypes

class CONNECTION_INFO_1(ctypes.Structure):
    _fields_ = [
        ("coni1_id", wintypes.DWORD),
        ("coni1_type", wintypes.DWORD),
        ("coni1_num_opens", wintypes.DWORD),
        ("coni1_num_users", wintypes.DWORD),
        ("coni1_time", wintypes.DWORD),
        ("coni1_username", ctypes.c_void_p),
        ("coni1_netname", ctypes.c_void_p),
    ]
#[repr(C)]
pub struct CONNECTION_INFO_1 {
    pub coni1_id: u32,
    pub coni1_type: u32,
    pub coni1_num_opens: u32,
    pub coni1_num_users: u32,
    pub coni1_time: u32,
    pub coni1_username: *mut core::ffi::c_void,
    pub coni1_netname: *mut core::ffi::c_void,
}
import "golang.org/x/sys/windows"

type CONNECTION_INFO_1 struct {
	coni1_id uint32
	coni1_type uint32
	coni1_num_opens uint32
	coni1_num_users uint32
	coni1_time uint32
	coni1_username uintptr
	coni1_netname uintptr
}
type
  CONNECTION_INFO_1 = record
    coni1_id: DWORD;
    coni1_type: DWORD;
    coni1_num_opens: DWORD;
    coni1_num_users: DWORD;
    coni1_time: DWORD;
    coni1_username: Pointer;
    coni1_netname: Pointer;
  end;
const CONNECTION_INFO_1 = extern struct {
    coni1_id: u32,
    coni1_type: u32,
    coni1_num_opens: u32,
    coni1_num_users: u32,
    coni1_time: u32,
    coni1_username: ?*anyopaque,
    coni1_netname: ?*anyopaque,
};
type
  CONNECTION_INFO_1 {.bycopy.} = object
    coni1_id: uint32
    coni1_type: uint32
    coni1_num_opens: uint32
    coni1_num_users: uint32
    coni1_time: uint32
    coni1_username: pointer
    coni1_netname: pointer
struct CONNECTION_INFO_1
{
    uint coni1_id;
    uint coni1_type;
    uint coni1_num_opens;
    uint coni1_num_users;
    uint coni1_time;
    void* coni1_username;
    void* coni1_netname;
}

HSP用 定義

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

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

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