ホーム › Networking.NetworkListManager › NLM_DATAPLAN_STATUS
NLM_DATAPLAN_STATUS
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| InterfaceGuid | GUID | 16 | +0 | +0 | 対象ネットワークインターフェイスを識別するGUID。 |
| UsageData | NLM_USAGE_DATA | 12 | +16 | +16 | 現在のデータ使用量と最終同期時刻を示す使用状況データ。 |
| DataLimitInMegabytes | DWORD | 4 | +28 | +28 | データプランの上限をメガバイト単位で示す。 |
| InboundBandwidthInKbps | DWORD | 4 | +32 | +32 | 受信方向の帯域幅をKbps単位で示す。 |
| OutboundBandwidthInKbps | DWORD | 4 | +36 | +36 | 送信方向の帯域幅をKbps単位で示す。 |
| NextBillingCycle | FILETIME | 8 | +40 | +40 | 次回の課金サイクル開始日時(FILETIME)。 |
| MaxTransferSizeInMegabytes | DWORD | 4 | +48 | +48 | 一度に転送可能な最大サイズをメガバイト単位で示す。 |
| Reserved | DWORD | 4 | +52 | +52 | 将来の使用のために予約された領域。 |
各言語での定義
#include <windows.h>
// FILETIME (x64 8 / x86 8 バイト)
typedef struct FILETIME {
DWORD dwLowDateTime;
DWORD dwHighDateTime;
} FILETIME;
// NLM_USAGE_DATA (x64 12 / x86 12 バイト)
typedef struct NLM_USAGE_DATA {
DWORD UsageInMegabytes;
FILETIME LastSyncTime;
} NLM_USAGE_DATA;
// NLM_DATAPLAN_STATUS (x64 56 / x86 56 バイト)
typedef struct NLM_DATAPLAN_STATUS {
GUID InterfaceGuid;
NLM_USAGE_DATA UsageData;
DWORD DataLimitInMegabytes;
DWORD InboundBandwidthInKbps;
DWORD OutboundBandwidthInKbps;
FILETIME NextBillingCycle;
DWORD MaxTransferSizeInMegabytes;
DWORD Reserved;
} NLM_DATAPLAN_STATUS;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct FILETIME
{
public uint dwLowDateTime;
public uint dwHighDateTime;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct NLM_USAGE_DATA
{
public uint UsageInMegabytes;
public FILETIME LastSyncTime;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct NLM_DATAPLAN_STATUS
{
public Guid InterfaceGuid;
public NLM_USAGE_DATA UsageData;
public uint DataLimitInMegabytes;
public uint InboundBandwidthInKbps;
public uint OutboundBandwidthInKbps;
public FILETIME NextBillingCycle;
public uint MaxTransferSizeInMegabytes;
public uint Reserved;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure FILETIME
Public dwLowDateTime As UInteger
Public dwHighDateTime As UInteger
End Structure
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure NLM_USAGE_DATA
Public UsageInMegabytes As UInteger
Public LastSyncTime As FILETIME
End Structure
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure NLM_DATAPLAN_STATUS
Public InterfaceGuid As Guid
Public UsageData As NLM_USAGE_DATA
Public DataLimitInMegabytes As UInteger
Public InboundBandwidthInKbps As UInteger
Public OutboundBandwidthInKbps As UInteger
Public NextBillingCycle As FILETIME
Public MaxTransferSizeInMegabytes As UInteger
Public Reserved As UInteger
End Structureimport ctypes
from ctypes import wintypes
class FILETIME(ctypes.Structure):
_fields_ = [
("dwLowDateTime", wintypes.DWORD),
("dwHighDateTime", wintypes.DWORD),
]
class NLM_USAGE_DATA(ctypes.Structure):
_fields_ = [
("UsageInMegabytes", wintypes.DWORD),
("LastSyncTime", FILETIME),
]
class NLM_DATAPLAN_STATUS(ctypes.Structure):
_fields_ = [
("InterfaceGuid", GUID),
("UsageData", NLM_USAGE_DATA),
("DataLimitInMegabytes", wintypes.DWORD),
("InboundBandwidthInKbps", wintypes.DWORD),
("OutboundBandwidthInKbps", wintypes.DWORD),
("NextBillingCycle", FILETIME),
("MaxTransferSizeInMegabytes", wintypes.DWORD),
("Reserved", wintypes.DWORD),
]#[repr(C)]
pub struct FILETIME {
pub dwLowDateTime: u32,
pub dwHighDateTime: u32,
}
#[repr(C)]
pub struct NLM_USAGE_DATA {
pub UsageInMegabytes: u32,
pub LastSyncTime: FILETIME,
}
#[repr(C)]
pub struct NLM_DATAPLAN_STATUS {
pub InterfaceGuid: GUID,
pub UsageData: NLM_USAGE_DATA,
pub DataLimitInMegabytes: u32,
pub InboundBandwidthInKbps: u32,
pub OutboundBandwidthInKbps: u32,
pub NextBillingCycle: FILETIME,
pub MaxTransferSizeInMegabytes: u32,
pub Reserved: u32,
}import "golang.org/x/sys/windows"
type FILETIME struct {
dwLowDateTime uint32
dwHighDateTime uint32
}
type NLM_USAGE_DATA struct {
UsageInMegabytes uint32
LastSyncTime FILETIME
}
type NLM_DATAPLAN_STATUS struct {
InterfaceGuid windows.GUID
UsageData NLM_USAGE_DATA
DataLimitInMegabytes uint32
InboundBandwidthInKbps uint32
OutboundBandwidthInKbps uint32
NextBillingCycle FILETIME
MaxTransferSizeInMegabytes uint32
Reserved uint32
}type
FILETIME = record
dwLowDateTime: DWORD;
dwHighDateTime: DWORD;
end;
NLM_USAGE_DATA = record
UsageInMegabytes: DWORD;
LastSyncTime: FILETIME;
end;
NLM_DATAPLAN_STATUS = record
InterfaceGuid: TGUID;
UsageData: NLM_USAGE_DATA;
DataLimitInMegabytes: DWORD;
InboundBandwidthInKbps: DWORD;
OutboundBandwidthInKbps: DWORD;
NextBillingCycle: FILETIME;
MaxTransferSizeInMegabytes: DWORD;
Reserved: DWORD;
end;const FILETIME = extern struct {
dwLowDateTime: u32,
dwHighDateTime: u32,
};
const NLM_USAGE_DATA = extern struct {
UsageInMegabytes: u32,
LastSyncTime: FILETIME,
};
const NLM_DATAPLAN_STATUS = extern struct {
InterfaceGuid: GUID,
UsageData: NLM_USAGE_DATA,
DataLimitInMegabytes: u32,
InboundBandwidthInKbps: u32,
OutboundBandwidthInKbps: u32,
NextBillingCycle: FILETIME,
MaxTransferSizeInMegabytes: u32,
Reserved: u32,
};type
FILETIME {.bycopy.} = object
dwLowDateTime: uint32
dwHighDateTime: uint32
NLM_USAGE_DATA {.bycopy.} = object
UsageInMegabytes: uint32
LastSyncTime: FILETIME
NLM_DATAPLAN_STATUS {.bycopy.} = object
InterfaceGuid: GUID
UsageData: NLM_USAGE_DATA
DataLimitInMegabytes: uint32
InboundBandwidthInKbps: uint32
OutboundBandwidthInKbps: uint32
NextBillingCycle: FILETIME
MaxTransferSizeInMegabytes: uint32
Reserved: uint32struct FILETIME
{
uint dwLowDateTime;
uint dwHighDateTime;
}
struct NLM_USAGE_DATA
{
uint UsageInMegabytes;
FILETIME LastSyncTime;
}
struct NLM_DATAPLAN_STATUS
{
GUID InterfaceGuid;
NLM_USAGE_DATA UsageData;
uint DataLimitInMegabytes;
uint InboundBandwidthInKbps;
uint OutboundBandwidthInKbps;
FILETIME NextBillingCycle;
uint MaxTransferSizeInMegabytes;
uint Reserved;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; NLM_DATAPLAN_STATUS サイズ: 56 バイト(x64)
dim st, 14 ; 4byte整数×14(構造体サイズ 56 / 4 切り上げ)
; InterfaceGuid : GUID (+0, 16byte) varptr(st)+0 を基点に操作(16byte:入れ子/配列)
; UsageData : NLM_USAGE_DATA (+16, 12byte) varptr(st)+16 を基点に操作(12byte:入れ子/配列)
; DataLimitInMegabytes : DWORD (+28, 4byte) st.7 = 値 / 値 = st.7 (lpoke/lpeek も可)
; InboundBandwidthInKbps : DWORD (+32, 4byte) st.8 = 値 / 値 = st.8 (lpoke/lpeek も可)
; OutboundBandwidthInKbps : DWORD (+36, 4byte) st.9 = 値 / 値 = st.9 (lpoke/lpeek も可)
; NextBillingCycle : FILETIME (+40, 8byte) varptr(st)+40 を基点に操作(8byte:入れ子/配列)
; MaxTransferSizeInMegabytes : DWORD (+48, 4byte) st.12 = 値 / 値 = st.12 (lpoke/lpeek も可)
; Reserved : DWORD (+52, 4byte) st.13 = 値 / 値 = st.13 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global GUID, pack=1
#field int Data1
#field short Data2
#field short Data3
#field byte Data4 8
#endstruct
#defstruct global FILETIME
#field int dwLowDateTime
#field int dwHighDateTime
#endstruct
#defstruct global NLM_USAGE_DATA
#field int UsageInMegabytes
#field FILETIME LastSyncTime
#endstruct
#defstruct global NLM_DATAPLAN_STATUS
#field GUID InterfaceGuid
#field NLM_USAGE_DATA UsageData
#field int DataLimitInMegabytes
#field int InboundBandwidthInKbps
#field int OutboundBandwidthInKbps
#field FILETIME NextBillingCycle
#field int MaxTransferSizeInMegabytes
#field int Reserved
#endstruct
stdim st, NLM_DATAPLAN_STATUS ; NSTRUCT 変数を確保
st->DataLimitInMegabytes = 100
mes "DataLimitInMegabytes=" + st->DataLimitInMegabytes