ホーム › NetworkManagement.NetManagement › USE_INFO_1
USE_INFO_1
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| ui1_local | LPWSTR | 8/4 | +0 | +0 | 接続を割り当てるローカルデバイス名を表す文字列。NULL可。 |
| ui1_remote | LPWSTR | 8/4 | +8 | +4 | 接続先のリモート共有のUNCパスを表す文字列へのポインタ。 |
| ui1_password | LPWSTR | 8/4 | +16 | +8 | 接続認証に用いるパスワードを表す文字列。NULLで省略可。 |
| ui1_status | DWORD | 4 | +24 | +12 | 接続の現在の状態を示す。USE_OK等の状態コードを保持する。 |
| ui1_asg_type | USE_INFO_ASG_TYPE | 4 | +28 | +16 | 接続先リソースの種別を示す列挙値(ディスク/プリンタ等)。 |
| ui1_refcount | DWORD | 4 | +32 | +20 | この接続を参照しているファイル等の数を示す参照カウント。 |
| ui1_usecount | DWORD | 4 | +36 | +24 | この接続の明示的な使用回数を示すカウント。 |
各言語での定義
#include <windows.h>
// USE_INFO_1 (x64 40 / x86 28 バイト)
typedef struct USE_INFO_1 {
LPWSTR ui1_local;
LPWSTR ui1_remote;
LPWSTR ui1_password;
DWORD ui1_status;
USE_INFO_ASG_TYPE ui1_asg_type;
DWORD ui1_refcount;
DWORD ui1_usecount;
} USE_INFO_1;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct USE_INFO_1
{
public IntPtr ui1_local;
public IntPtr ui1_remote;
public IntPtr ui1_password;
public uint ui1_status;
public uint ui1_asg_type;
public uint ui1_refcount;
public uint ui1_usecount;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure USE_INFO_1
Public ui1_local As IntPtr
Public ui1_remote As IntPtr
Public ui1_password As IntPtr
Public ui1_status As UInteger
Public ui1_asg_type As UInteger
Public ui1_refcount As UInteger
Public ui1_usecount As UInteger
End Structureimport ctypes
from ctypes import wintypes
class USE_INFO_1(ctypes.Structure):
_fields_ = [
("ui1_local", ctypes.c_void_p),
("ui1_remote", ctypes.c_void_p),
("ui1_password", ctypes.c_void_p),
("ui1_status", wintypes.DWORD),
("ui1_asg_type", wintypes.DWORD),
("ui1_refcount", wintypes.DWORD),
("ui1_usecount", wintypes.DWORD),
]#[repr(C)]
pub struct USE_INFO_1 {
pub ui1_local: *mut core::ffi::c_void,
pub ui1_remote: *mut core::ffi::c_void,
pub ui1_password: *mut core::ffi::c_void,
pub ui1_status: u32,
pub ui1_asg_type: u32,
pub ui1_refcount: u32,
pub ui1_usecount: u32,
}import "golang.org/x/sys/windows"
type USE_INFO_1 struct {
ui1_local uintptr
ui1_remote uintptr
ui1_password uintptr
ui1_status uint32
ui1_asg_type uint32
ui1_refcount uint32
ui1_usecount uint32
}type
USE_INFO_1 = record
ui1_local: Pointer;
ui1_remote: Pointer;
ui1_password: Pointer;
ui1_status: DWORD;
ui1_asg_type: DWORD;
ui1_refcount: DWORD;
ui1_usecount: DWORD;
end;const USE_INFO_1 = extern struct {
ui1_local: ?*anyopaque,
ui1_remote: ?*anyopaque,
ui1_password: ?*anyopaque,
ui1_status: u32,
ui1_asg_type: u32,
ui1_refcount: u32,
ui1_usecount: u32,
};type
USE_INFO_1 {.bycopy.} = object
ui1_local: pointer
ui1_remote: pointer
ui1_password: pointer
ui1_status: uint32
ui1_asg_type: uint32
ui1_refcount: uint32
ui1_usecount: uint32struct USE_INFO_1
{
void* ui1_local;
void* ui1_remote;
void* ui1_password;
uint ui1_status;
uint ui1_asg_type;
uint ui1_refcount;
uint ui1_usecount;
}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_1 サイズ: 28 バイト(x86)
dim st, 7 ; 4byte整数×7(構造体サイズ 28 / 4 切り上げ)
; ui1_local : LPWSTR (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; ui1_remote : LPWSTR (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; ui1_password : LPWSTR (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; ui1_status : DWORD (+12, 4byte) st.3 = 値 / 値 = st.3 (lpoke/lpeek も可)
; ui1_asg_type : USE_INFO_ASG_TYPE (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; ui1_refcount : DWORD (+20, 4byte) st.5 = 値 / 値 = st.5 (lpoke/lpeek も可)
; ui1_usecount : DWORD (+24, 4byte) st.6 = 値 / 値 = st.6 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; USE_INFO_1 サイズ: 40 バイト(x64)
dim st, 10 ; 4byte整数×10(構造体サイズ 40 / 4 切り上げ)
; ui1_local : LPWSTR (+0, 8byte) qpoke st,0,値 / qpeek(st,0) ※IronHSPのみ。3.7/3.8は lpoke st,0,下位 : lpoke st,4,上位
; ui1_remote : LPWSTR (+8, 8byte) qpoke st,8,値 / qpeek(st,8) ※IronHSPのみ。3.7/3.8は lpoke st,8,下位 : lpoke st,12,上位
; ui1_password : LPWSTR (+16, 8byte) qpoke st,16,値 / qpeek(st,16) ※IronHSPのみ。3.7/3.8は lpoke st,16,下位 : lpoke st,20,上位
; ui1_status : DWORD (+24, 4byte) st.6 = 値 / 値 = st.6 (lpoke/lpeek も可)
; ui1_asg_type : USE_INFO_ASG_TYPE (+28, 4byte) st.7 = 値 / 値 = st.7 (lpoke/lpeek も可)
; ui1_refcount : DWORD (+32, 4byte) st.8 = 値 / 値 = st.8 (lpoke/lpeek も可)
; ui1_usecount : DWORD (+36, 4byte) st.9 = 値 / 値 = st.9 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global USE_INFO_1
#field intptr ui1_local
#field intptr ui1_remote
#field intptr ui1_password
#field int ui1_status
#field int ui1_asg_type
#field int ui1_refcount
#field int ui1_usecount
#endstruct
stdim st, USE_INFO_1 ; NSTRUCT 変数を確保
st->ui1_status = 100
mes "ui1_status=" + st->ui1_status