ホーム › NetworkManagement.WNet › NETRESOURCEW
NETRESOURCEW
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| dwScope | NET_RESOURCE_SCOPE | 4 | +0 | +0 | リソースの列挙範囲(接続済み/永続/グローバルなど)。 |
| dwType | NET_RESOURCE_TYPE | 4 | +4 | +4 | リソースの種類(ディスク/プリンターなど)。 |
| dwDisplayType | DWORD | 4 | +8 | +8 | シェルでの表示種別(ドメイン/サーバー/共有など)。 |
| dwUsage | DWORD | 4 | +12 | +12 | リソースの用途を示すビットフラグ(接続可能/コンテナーなど)。 |
| lpLocalName | LPWSTR | 8/4 | +16 | +16 | リソースにマップされたローカルデバイス名(Unicode)。NULL可。 |
| lpRemoteName | LPWSTR | 8/4 | +24 | +20 | ネットワークリソースのリモート名(Unicode)。 |
| lpComment | LPWSTR | 8/4 | +32 | +24 | プロバイダーが提供するコメント文字列(Unicode)。 |
| lpProvider | LPWSTR | 8/4 | +40 | +28 | リソースを所有するプロバイダー名(Unicode)。NULL可。 |
各言語での定義
#include <windows.h>
// NETRESOURCEW (x64 48 / x86 32 バイト)
typedef struct NETRESOURCEW {
NET_RESOURCE_SCOPE dwScope;
NET_RESOURCE_TYPE dwType;
DWORD dwDisplayType;
DWORD dwUsage;
LPWSTR lpLocalName;
LPWSTR lpRemoteName;
LPWSTR lpComment;
LPWSTR lpProvider;
} NETRESOURCEW;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct NETRESOURCEW
{
public uint dwScope;
public uint dwType;
public uint dwDisplayType;
public uint dwUsage;
public IntPtr lpLocalName;
public IntPtr lpRemoteName;
public IntPtr lpComment;
public IntPtr lpProvider;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure NETRESOURCEW
Public dwScope As UInteger
Public dwType As UInteger
Public dwDisplayType As UInteger
Public dwUsage As UInteger
Public lpLocalName As IntPtr
Public lpRemoteName As IntPtr
Public lpComment As IntPtr
Public lpProvider As IntPtr
End Structureimport ctypes
from ctypes import wintypes
class NETRESOURCEW(ctypes.Structure):
_fields_ = [
("dwScope", wintypes.DWORD),
("dwType", wintypes.DWORD),
("dwDisplayType", wintypes.DWORD),
("dwUsage", wintypes.DWORD),
("lpLocalName", ctypes.c_void_p),
("lpRemoteName", ctypes.c_void_p),
("lpComment", ctypes.c_void_p),
("lpProvider", ctypes.c_void_p),
]#[repr(C)]
pub struct NETRESOURCEW {
pub dwScope: u32,
pub dwType: u32,
pub dwDisplayType: u32,
pub dwUsage: u32,
pub lpLocalName: *mut core::ffi::c_void,
pub lpRemoteName: *mut core::ffi::c_void,
pub lpComment: *mut core::ffi::c_void,
pub lpProvider: *mut core::ffi::c_void,
}import "golang.org/x/sys/windows"
type NETRESOURCEW struct {
dwScope uint32
dwType uint32
dwDisplayType uint32
dwUsage uint32
lpLocalName uintptr
lpRemoteName uintptr
lpComment uintptr
lpProvider uintptr
}type
NETRESOURCEW = record
dwScope: DWORD;
dwType: DWORD;
dwDisplayType: DWORD;
dwUsage: DWORD;
lpLocalName: Pointer;
lpRemoteName: Pointer;
lpComment: Pointer;
lpProvider: Pointer;
end;const NETRESOURCEW = extern struct {
dwScope: u32,
dwType: u32,
dwDisplayType: u32,
dwUsage: u32,
lpLocalName: ?*anyopaque,
lpRemoteName: ?*anyopaque,
lpComment: ?*anyopaque,
lpProvider: ?*anyopaque,
};type
NETRESOURCEW {.bycopy.} = object
dwScope: uint32
dwType: uint32
dwDisplayType: uint32
dwUsage: uint32
lpLocalName: pointer
lpRemoteName: pointer
lpComment: pointer
lpProvider: pointerstruct NETRESOURCEW
{
uint dwScope;
uint dwType;
uint dwDisplayType;
uint dwUsage;
void* lpLocalName;
void* lpRemoteName;
void* lpComment;
void* lpProvider;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; NETRESOURCEW サイズ: 32 バイト(x86)
dim st, 8 ; 4byte整数×8(構造体サイズ 32 / 4 切り上げ)
; dwScope : NET_RESOURCE_SCOPE (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; dwType : NET_RESOURCE_TYPE (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; dwDisplayType : DWORD (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; dwUsage : DWORD (+12, 4byte) st.3 = 値 / 値 = st.3 (lpoke/lpeek も可)
; lpLocalName : LPWSTR (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; lpRemoteName : LPWSTR (+20, 4byte) st.5 = 値 / 値 = st.5 (lpoke/lpeek も可)
; lpComment : LPWSTR (+24, 4byte) st.6 = 値 / 値 = st.6 (lpoke/lpeek も可)
; lpProvider : LPWSTR (+28, 4byte) st.7 = 値 / 値 = st.7 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; NETRESOURCEW サイズ: 48 バイト(x64)
dim st, 12 ; 4byte整数×12(構造体サイズ 48 / 4 切り上げ)
; dwScope : NET_RESOURCE_SCOPE (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; dwType : NET_RESOURCE_TYPE (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; dwDisplayType : DWORD (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; dwUsage : DWORD (+12, 4byte) st.3 = 値 / 値 = st.3 (lpoke/lpeek も可)
; lpLocalName : LPWSTR (+16, 8byte) qpoke st,16,値 / qpeek(st,16) ※IronHSPのみ。3.7/3.8は lpoke st,16,下位 : lpoke st,20,上位
; lpRemoteName : LPWSTR (+24, 8byte) qpoke st,24,値 / qpeek(st,24) ※IronHSPのみ。3.7/3.8は lpoke st,24,下位 : lpoke st,28,上位
; lpComment : LPWSTR (+32, 8byte) qpoke st,32,値 / qpeek(st,32) ※IronHSPのみ。3.7/3.8は lpoke st,32,下位 : lpoke st,36,上位
; lpProvider : LPWSTR (+40, 8byte) qpoke st,40,値 / qpeek(st,40) ※IronHSPのみ。3.7/3.8は lpoke st,40,下位 : lpoke st,44,上位
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global NETRESOURCEW
#field int dwScope
#field int dwType
#field int dwDisplayType
#field int dwUsage
#field intptr lpLocalName
#field intptr lpRemoteName
#field intptr lpComment
#field intptr lpProvider
#endstruct
stdim st, NETRESOURCEW ; NSTRUCT 変数を確保
st->dwScope = 100
mes "dwScope=" + st->dwScope