ホーム › NetworkManagement.WNet › NETINFOSTRUCT
NETINFOSTRUCT
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| cbStructure | DWORD | 4 | +0 | +0 | NETINFOSTRUCT 構造体のサイズ (バイト単位)。呼び出し側は、渡す構造体のサイズを示すためにこの値を指定しなければなりません。関数から戻ると、このメンバーには構造体のサイズが格納されます。 | ||||||||
| dwProviderVersion | DWORD | 4 | +4 | +4 | ネットワーク プロバイダー ソフトウェアのバージョン番号。 | ||||||||
| dwStatus | WIN32_ERROR | 4 | +8 | +8 | ネットワーク プロバイダー ソフトウェアの現在の状態。このメンバーには、次のいずれかの値を指定できます。
| ||||||||
| dwCharacteristics | NETINFOSTRUCT_CHARACTERISTICS | 4 | +12 | +12 | ネットワーク プロバイダー ソフトウェアの特性。 この値は 0 です。 Windows Me/98/95: このメンバーには、次の値の 1 つ以上を指定できます。 | ||||||||
| dwHandle | UINT_PTR | 8/4 | +16 | +16 | ネットワーク プロバイダーまたは 16 ビット Windows ネットワーク ドライバーのインスタンス ハンドル。 | ||||||||
| wNetType | WORD | 2 | +24 | +20 | 実行中のネットワークに固有のネットワーク タイプ。この値は、リソースが永続的な場合やリンクに保存されている場合に、リソースを特定のネットワークに関連付けます。ネットワーク タイプの完全な一覧は、ヘッダー ファイル Winnetwk.h にあります。 | ||||||||
| dwPrinters | DWORD | 4 | +28 | +24 | ローカル プリンター デバイスのリダイレクトに有効なプリンター番号を示すビット フラグのセット。最下位ビットが LPT1 に対応します。 Windows Me/98/95: この値は常に –1 に設定されます。 | ||||||||
| dwDrives | DWORD | 4 | +32 | +28 | ディスク ドライブのリダイレクトに有効なローカル ディスク デバイスを示すビット フラグのセット。最下位ビットが A: に対応します。 Windows Me/98/95: この値は常に –1 に設定されます。 |
公式ドキュメント
NETINFOSTRUCT 構造体には、 WNetGetNetworkInformation 関数から返される、ネットワーク プロバイダーを説明する情報が格納されます。
解説(Remarks)
NETINFOSTRUCT 構造体には、ネットワーク プロバイダー ソフトウェアのバージョンやネットワークの現在の状態など、ネットワークを説明する情報が格納されます。
出典・ライセンス: 上記「公式ドキュメント」の内容は Microsoft の Win32 API ドキュメント(MicrosoftDocs/sdk-api)を日本語に翻訳・改変したものです。© Microsoft Corporation. CC BY 4.0 で提供。
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)
各言語での定義
#include <windows.h>
// NETINFOSTRUCT (x64 40 / x86 32 バイト)
typedef struct NETINFOSTRUCT {
DWORD cbStructure;
DWORD dwProviderVersion;
WIN32_ERROR dwStatus;
NETINFOSTRUCT_CHARACTERISTICS dwCharacteristics;
UINT_PTR dwHandle;
WORD wNetType;
DWORD dwPrinters;
DWORD dwDrives;
} NETINFOSTRUCT;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct NETINFOSTRUCT
{
public uint cbStructure;
public uint dwProviderVersion;
public uint dwStatus;
public uint dwCharacteristics;
public UIntPtr dwHandle;
public ushort wNetType;
public uint dwPrinters;
public uint dwDrives;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure NETINFOSTRUCT
Public cbStructure As UInteger
Public dwProviderVersion As UInteger
Public dwStatus As UInteger
Public dwCharacteristics As UInteger
Public dwHandle As UIntPtr
Public wNetType As UShort
Public dwPrinters As UInteger
Public dwDrives As UInteger
End Structureimport ctypes
from ctypes import wintypes
class NETINFOSTRUCT(ctypes.Structure):
_fields_ = [
("cbStructure", wintypes.DWORD),
("dwProviderVersion", wintypes.DWORD),
("dwStatus", wintypes.DWORD),
("dwCharacteristics", wintypes.DWORD),
("dwHandle", ctypes.c_size_t),
("wNetType", ctypes.c_ushort),
("dwPrinters", wintypes.DWORD),
("dwDrives", wintypes.DWORD),
]#[repr(C)]
pub struct NETINFOSTRUCT {
pub cbStructure: u32,
pub dwProviderVersion: u32,
pub dwStatus: u32,
pub dwCharacteristics: u32,
pub dwHandle: usize,
pub wNetType: u16,
pub dwPrinters: u32,
pub dwDrives: u32,
}import "golang.org/x/sys/windows"
type NETINFOSTRUCT struct {
cbStructure uint32
dwProviderVersion uint32
dwStatus uint32
dwCharacteristics uint32
dwHandle uintptr
wNetType uint16
dwPrinters uint32
dwDrives uint32
}type
NETINFOSTRUCT = record
cbStructure: DWORD;
dwProviderVersion: DWORD;
dwStatus: DWORD;
dwCharacteristics: DWORD;
dwHandle: NativeUInt;
wNetType: Word;
dwPrinters: DWORD;
dwDrives: DWORD;
end;const NETINFOSTRUCT = extern struct {
cbStructure: u32,
dwProviderVersion: u32,
dwStatus: u32,
dwCharacteristics: u32,
dwHandle: usize,
wNetType: u16,
dwPrinters: u32,
dwDrives: u32,
};type
NETINFOSTRUCT {.bycopy.} = object
cbStructure: uint32
dwProviderVersion: uint32
dwStatus: uint32
dwCharacteristics: uint32
dwHandle: uint
wNetType: uint16
dwPrinters: uint32
dwDrives: uint32struct NETINFOSTRUCT
{
uint cbStructure;
uint dwProviderVersion;
uint dwStatus;
uint dwCharacteristics;
size_t dwHandle;
ushort wNetType;
uint dwPrinters;
uint dwDrives;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; NETINFOSTRUCT サイズ: 32 バイト(x86)
dim st, 8 ; 4byte整数×8(構造体サイズ 32 / 4 切り上げ)
; cbStructure : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; dwProviderVersion : DWORD (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; dwStatus : WIN32_ERROR (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; dwCharacteristics : NETINFOSTRUCT_CHARACTERISTICS (+12, 4byte) st.3 = 値 / 値 = st.3 (lpoke/lpeek も可)
; dwHandle : UINT_PTR (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; wNetType : WORD (+20, 2byte) wpoke st,20,値 / 値 = wpeek(st,20)
; dwPrinters : DWORD (+24, 4byte) st.6 = 値 / 値 = st.6 (lpoke/lpeek も可)
; dwDrives : DWORD (+28, 4byte) st.7 = 値 / 値 = st.7 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; NETINFOSTRUCT サイズ: 40 バイト(x64)
dim st, 10 ; 4byte整数×10(構造体サイズ 40 / 4 切り上げ)
; cbStructure : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; dwProviderVersion : DWORD (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; dwStatus : WIN32_ERROR (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; dwCharacteristics : NETINFOSTRUCT_CHARACTERISTICS (+12, 4byte) st.3 = 値 / 値 = st.3 (lpoke/lpeek も可)
; dwHandle : UINT_PTR (+16, 8byte) qpoke st,16,値 / qpeek(st,16) ※IronHSPのみ。3.7/3.8は lpoke st,16,下位 : lpoke st,20,上位
; wNetType : WORD (+24, 2byte) wpoke st,24,値 / 値 = wpeek(st,24)
; dwPrinters : DWORD (+28, 4byte) st.7 = 値 / 値 = st.7 (lpoke/lpeek も可)
; dwDrives : DWORD (+32, 4byte) st.8 = 値 / 値 = st.8 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global NETINFOSTRUCT
#field int cbStructure
#field int dwProviderVersion
#field int dwStatus
#field int dwCharacteristics
#field intptr dwHandle
#field short wNetType
#field int dwPrinters
#field int dwDrives
#endstruct
stdim st, NETINFOSTRUCT ; NSTRUCT 変数を確保
st->cbStructure = 100
mes "cbStructure=" + st->cbStructure