Win32 API 日本語リファレンス
ホームNetworkManagement.WindowsConnectionManager › WCM_DATAPLAN_STATUS

WCM_DATAPLAN_STATUS

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

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

フィールド

フィールドサイズx64x86説明
UsageDataWCM_USAGE_DATA12+0+0現在のデータ使用量と最終同期時刻。
DataLimitInMegabytesDWORD4+12+12データプランの上限(メガバイト単位)。
InboundBandwidthInKbpsDWORD4+16+16受信帯域幅(Kbps単位)。
OutboundBandwidthInKbpsDWORD4+20+20送信帯域幅(Kbps単位)。
BillingCycleWCM_BILLING_CYCLE_INFO28+24+24課金サイクル情報(開始日・期間・リセット)。
MaxTransferSizeInMegabytesDWORD4+52+52単一転送で推奨される最大サイズ(メガバイト単位)。
ReservedDWORD4+56+56将来の拡張用の予約フィールド。

各言語での定義

#include <windows.h>

// FILETIME  (x64 8 / x86 8 バイト)
typedef struct FILETIME {
    DWORD dwLowDateTime;
    DWORD dwHighDateTime;
} FILETIME;

// WCM_USAGE_DATA  (x64 12 / x86 12 バイト)
typedef struct WCM_USAGE_DATA {
    DWORD UsageInMegabytes;
    FILETIME LastSyncTime;
} WCM_USAGE_DATA;

// WCM_TIME_INTERVAL  (x64 14 / x86 14 バイト)
typedef struct WCM_TIME_INTERVAL {
    WORD wYear;
    WORD wMonth;
    WORD wDay;
    WORD wHour;
    WORD wMinute;
    WORD wSecond;
    WORD wMilliseconds;
} WCM_TIME_INTERVAL;

// WCM_BILLING_CYCLE_INFO  (x64 28 / x86 28 バイト)
typedef struct WCM_BILLING_CYCLE_INFO {
    FILETIME StartDate;
    WCM_TIME_INTERVAL Duration;
    BOOL Reset;
} WCM_BILLING_CYCLE_INFO;

// WCM_DATAPLAN_STATUS  (x64 60 / x86 60 バイト)
typedef struct WCM_DATAPLAN_STATUS {
    WCM_USAGE_DATA UsageData;
    DWORD DataLimitInMegabytes;
    DWORD InboundBandwidthInKbps;
    DWORD OutboundBandwidthInKbps;
    WCM_BILLING_CYCLE_INFO BillingCycle;
    DWORD MaxTransferSizeInMegabytes;
    DWORD Reserved;
} WCM_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 WCM_USAGE_DATA
{
    public uint UsageInMegabytes;
    public FILETIME LastSyncTime;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct WCM_TIME_INTERVAL
{
    public ushort wYear;
    public ushort wMonth;
    public ushort wDay;
    public ushort wHour;
    public ushort wMinute;
    public ushort wSecond;
    public ushort wMilliseconds;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct WCM_BILLING_CYCLE_INFO
{
    public FILETIME StartDate;
    public WCM_TIME_INTERVAL Duration;
    [MarshalAs(UnmanagedType.Bool)] public bool Reset;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct WCM_DATAPLAN_STATUS
{
    public WCM_USAGE_DATA UsageData;
    public uint DataLimitInMegabytes;
    public uint InboundBandwidthInKbps;
    public uint OutboundBandwidthInKbps;
    public WCM_BILLING_CYCLE_INFO BillingCycle;
    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 WCM_USAGE_DATA
    Public UsageInMegabytes As UInteger
    Public LastSyncTime As FILETIME
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure WCM_TIME_INTERVAL
    Public wYear As UShort
    Public wMonth As UShort
    Public wDay As UShort
    Public wHour As UShort
    Public wMinute As UShort
    Public wSecond As UShort
    Public wMilliseconds As UShort
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure WCM_BILLING_CYCLE_INFO
    Public StartDate As FILETIME
    Public Duration As WCM_TIME_INTERVAL
    <MarshalAs(UnmanagedType.Bool)> Public Reset As Boolean
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure WCM_DATAPLAN_STATUS
    Public UsageData As WCM_USAGE_DATA
    Public DataLimitInMegabytes As UInteger
    Public InboundBandwidthInKbps As UInteger
    Public OutboundBandwidthInKbps As UInteger
    Public BillingCycle As WCM_BILLING_CYCLE_INFO
    Public MaxTransferSizeInMegabytes As UInteger
    Public Reserved As UInteger
End Structure
import ctypes
from ctypes import wintypes

class FILETIME(ctypes.Structure):
    _fields_ = [
        ("dwLowDateTime", wintypes.DWORD),
        ("dwHighDateTime", wintypes.DWORD),
    ]

class WCM_USAGE_DATA(ctypes.Structure):
    _fields_ = [
        ("UsageInMegabytes", wintypes.DWORD),
        ("LastSyncTime", FILETIME),
    ]

class WCM_TIME_INTERVAL(ctypes.Structure):
    _fields_ = [
        ("wYear", ctypes.c_ushort),
        ("wMonth", ctypes.c_ushort),
        ("wDay", ctypes.c_ushort),
        ("wHour", ctypes.c_ushort),
        ("wMinute", ctypes.c_ushort),
        ("wSecond", ctypes.c_ushort),
        ("wMilliseconds", ctypes.c_ushort),
    ]

class WCM_BILLING_CYCLE_INFO(ctypes.Structure):
    _fields_ = [
        ("StartDate", FILETIME),
        ("Duration", WCM_TIME_INTERVAL),
        ("Reset", wintypes.BOOL),
    ]

class WCM_DATAPLAN_STATUS(ctypes.Structure):
    _fields_ = [
        ("UsageData", WCM_USAGE_DATA),
        ("DataLimitInMegabytes", wintypes.DWORD),
        ("InboundBandwidthInKbps", wintypes.DWORD),
        ("OutboundBandwidthInKbps", wintypes.DWORD),
        ("BillingCycle", WCM_BILLING_CYCLE_INFO),
        ("MaxTransferSizeInMegabytes", wintypes.DWORD),
        ("Reserved", wintypes.DWORD),
    ]
#[repr(C)]
pub struct FILETIME {
    pub dwLowDateTime: u32,
    pub dwHighDateTime: u32,
}

#[repr(C)]
pub struct WCM_USAGE_DATA {
    pub UsageInMegabytes: u32,
    pub LastSyncTime: FILETIME,
}

#[repr(C)]
pub struct WCM_TIME_INTERVAL {
    pub wYear: u16,
    pub wMonth: u16,
    pub wDay: u16,
    pub wHour: u16,
    pub wMinute: u16,
    pub wSecond: u16,
    pub wMilliseconds: u16,
}

#[repr(C)]
pub struct WCM_BILLING_CYCLE_INFO {
    pub StartDate: FILETIME,
    pub Duration: WCM_TIME_INTERVAL,
    pub Reset: i32,
}

#[repr(C)]
pub struct WCM_DATAPLAN_STATUS {
    pub UsageData: WCM_USAGE_DATA,
    pub DataLimitInMegabytes: u32,
    pub InboundBandwidthInKbps: u32,
    pub OutboundBandwidthInKbps: u32,
    pub BillingCycle: WCM_BILLING_CYCLE_INFO,
    pub MaxTransferSizeInMegabytes: u32,
    pub Reserved: u32,
}
import "golang.org/x/sys/windows"

type FILETIME struct {
	dwLowDateTime uint32
	dwHighDateTime uint32
}

type WCM_USAGE_DATA struct {
	UsageInMegabytes uint32
	LastSyncTime FILETIME
}

type WCM_TIME_INTERVAL struct {
	wYear uint16
	wMonth uint16
	wDay uint16
	wHour uint16
	wMinute uint16
	wSecond uint16
	wMilliseconds uint16
}

type WCM_BILLING_CYCLE_INFO struct {
	StartDate FILETIME
	Duration WCM_TIME_INTERVAL
	Reset int32
}

type WCM_DATAPLAN_STATUS struct {
	UsageData WCM_USAGE_DATA
	DataLimitInMegabytes uint32
	InboundBandwidthInKbps uint32
	OutboundBandwidthInKbps uint32
	BillingCycle WCM_BILLING_CYCLE_INFO
	MaxTransferSizeInMegabytes uint32
	Reserved uint32
}
type
  FILETIME = record
    dwLowDateTime: DWORD;
    dwHighDateTime: DWORD;
  end;

  WCM_USAGE_DATA = record
    UsageInMegabytes: DWORD;
    LastSyncTime: FILETIME;
  end;

  WCM_TIME_INTERVAL = record
    wYear: Word;
    wMonth: Word;
    wDay: Word;
    wHour: Word;
    wMinute: Word;
    wSecond: Word;
    wMilliseconds: Word;
  end;

  WCM_BILLING_CYCLE_INFO = record
    StartDate: FILETIME;
    Duration: WCM_TIME_INTERVAL;
    Reset: BOOL;
  end;

  WCM_DATAPLAN_STATUS = record
    UsageData: WCM_USAGE_DATA;
    DataLimitInMegabytes: DWORD;
    InboundBandwidthInKbps: DWORD;
    OutboundBandwidthInKbps: DWORD;
    BillingCycle: WCM_BILLING_CYCLE_INFO;
    MaxTransferSizeInMegabytes: DWORD;
    Reserved: DWORD;
  end;
const FILETIME = extern struct {
    dwLowDateTime: u32,
    dwHighDateTime: u32,
};

const WCM_USAGE_DATA = extern struct {
    UsageInMegabytes: u32,
    LastSyncTime: FILETIME,
};

const WCM_TIME_INTERVAL = extern struct {
    wYear: u16,
    wMonth: u16,
    wDay: u16,
    wHour: u16,
    wMinute: u16,
    wSecond: u16,
    wMilliseconds: u16,
};

const WCM_BILLING_CYCLE_INFO = extern struct {
    StartDate: FILETIME,
    Duration: WCM_TIME_INTERVAL,
    Reset: i32,
};

const WCM_DATAPLAN_STATUS = extern struct {
    UsageData: WCM_USAGE_DATA,
    DataLimitInMegabytes: u32,
    InboundBandwidthInKbps: u32,
    OutboundBandwidthInKbps: u32,
    BillingCycle: WCM_BILLING_CYCLE_INFO,
    MaxTransferSizeInMegabytes: u32,
    Reserved: u32,
};
type
  FILETIME {.bycopy.} = object
    dwLowDateTime: uint32
    dwHighDateTime: uint32

  WCM_USAGE_DATA {.bycopy.} = object
    UsageInMegabytes: uint32
    LastSyncTime: FILETIME

  WCM_TIME_INTERVAL {.bycopy.} = object
    wYear: uint16
    wMonth: uint16
    wDay: uint16
    wHour: uint16
    wMinute: uint16
    wSecond: uint16
    wMilliseconds: uint16

  WCM_BILLING_CYCLE_INFO {.bycopy.} = object
    StartDate: FILETIME
    Duration: WCM_TIME_INTERVAL
    Reset: int32

  WCM_DATAPLAN_STATUS {.bycopy.} = object
    UsageData: WCM_USAGE_DATA
    DataLimitInMegabytes: uint32
    InboundBandwidthInKbps: uint32
    OutboundBandwidthInKbps: uint32
    BillingCycle: WCM_BILLING_CYCLE_INFO
    MaxTransferSizeInMegabytes: uint32
    Reserved: uint32
struct FILETIME
{
    uint dwLowDateTime;
    uint dwHighDateTime;
}

struct WCM_USAGE_DATA
{
    uint UsageInMegabytes;
    FILETIME LastSyncTime;
}

struct WCM_TIME_INTERVAL
{
    ushort wYear;
    ushort wMonth;
    ushort wDay;
    ushort wHour;
    ushort wMinute;
    ushort wSecond;
    ushort wMilliseconds;
}

struct WCM_BILLING_CYCLE_INFO
{
    FILETIME StartDate;
    WCM_TIME_INTERVAL Duration;
    int Reset;
}

struct WCM_DATAPLAN_STATUS
{
    WCM_USAGE_DATA UsageData;
    uint DataLimitInMegabytes;
    uint InboundBandwidthInKbps;
    uint OutboundBandwidthInKbps;
    WCM_BILLING_CYCLE_INFO BillingCycle;
    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 レイアウト)
; WCM_DATAPLAN_STATUS サイズ: 60 バイト(x64)
dim st, 15    ; 4byte整数×15(構造体サイズ 60 / 4 切り上げ)
; UsageData : WCM_USAGE_DATA (+0, 12byte)  varptr(st)+0 を基点に操作(12byte:入れ子/配列)
; DataLimitInMegabytes : DWORD (+12, 4byte)  st.3 = 値  /  値 = st.3   (lpoke/lpeek も可)
; InboundBandwidthInKbps : DWORD (+16, 4byte)  st.4 = 値  /  値 = st.4   (lpoke/lpeek も可)
; OutboundBandwidthInKbps : DWORD (+20, 4byte)  st.5 = 値  /  値 = st.5   (lpoke/lpeek も可)
; BillingCycle : WCM_BILLING_CYCLE_INFO (+24, 28byte)  varptr(st)+24 を基点に操作(28byte:入れ子/配列)
; MaxTransferSizeInMegabytes : DWORD (+52, 4byte)  st.13 = 値  /  値 = st.13   (lpoke/lpeek も可)
; Reserved : DWORD (+56, 4byte)  st.14 = 値  /  値 = st.14   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global FILETIME
    #field int dwLowDateTime
    #field int dwHighDateTime
#endstruct

#defstruct global WCM_USAGE_DATA
    #field int UsageInMegabytes
    #field FILETIME LastSyncTime
#endstruct

#defstruct global WCM_TIME_INTERVAL
    #field short wYear
    #field short wMonth
    #field short wDay
    #field short wHour
    #field short wMinute
    #field short wSecond
    #field short wMilliseconds
#endstruct

#defstruct global WCM_BILLING_CYCLE_INFO
    #field FILETIME StartDate
    #field WCM_TIME_INTERVAL Duration
    #field bool Reset
#endstruct

#defstruct global WCM_DATAPLAN_STATUS
    #field WCM_USAGE_DATA UsageData
    #field int DataLimitInMegabytes
    #field int InboundBandwidthInKbps
    #field int OutboundBandwidthInKbps
    #field WCM_BILLING_CYCLE_INFO BillingCycle
    #field int MaxTransferSizeInMegabytes
    #field int Reserved
#endstruct

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