ホーム › Networking.NetworkListManager › NLM_SIMULATED_PROFILE_INFO
NLM_SIMULATED_PROFILE_INFO
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| ProfileName | WCHAR | 512 | +0 | +0 | シミュレートするネットワークプロファイル名を表すワイド文字配列。 |
| cost | NLM_CONNECTION_COST | 4 | +512 | +512 | ネットワークのコスト分類(従量制/無制限など)を示す列挙値。 |
| UsageInMegabytes | DWORD | 4 | +516 | +516 | シミュレートするデータ使用量をメガバイト単位で示す。 |
| DataLimitInMegabytes | DWORD | 4 | +520 | +520 | シミュレートするデータ上限をメガバイト単位で示す。 |
各言語での定義
#include <windows.h>
// NLM_SIMULATED_PROFILE_INFO (x64 524 / x86 524 バイト)
typedef struct NLM_SIMULATED_PROFILE_INFO {
WCHAR ProfileName[256];
NLM_CONNECTION_COST cost;
DWORD UsageInMegabytes;
DWORD DataLimitInMegabytes;
} NLM_SIMULATED_PROFILE_INFO;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct NLM_SIMULATED_PROFILE_INFO
{
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)] public string ProfileName;
public int cost;
public uint UsageInMegabytes;
public uint DataLimitInMegabytes;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure NLM_SIMULATED_PROFILE_INFO
<MarshalAs(UnmanagedType.ByValTStr, SizeConst:=256)> Public ProfileName As String
Public cost As Integer
Public UsageInMegabytes As UInteger
Public DataLimitInMegabytes As UInteger
End Structureimport ctypes
from ctypes import wintypes
class NLM_SIMULATED_PROFILE_INFO(ctypes.Structure):
_fields_ = [
("ProfileName", ctypes.c_wchar * 256),
("cost", ctypes.c_int),
("UsageInMegabytes", wintypes.DWORD),
("DataLimitInMegabytes", wintypes.DWORD),
]#[repr(C)]
pub struct NLM_SIMULATED_PROFILE_INFO {
pub ProfileName: [u16; 256],
pub cost: i32,
pub UsageInMegabytes: u32,
pub DataLimitInMegabytes: u32,
}import "golang.org/x/sys/windows"
type NLM_SIMULATED_PROFILE_INFO struct {
ProfileName [256]uint16
cost int32
UsageInMegabytes uint32
DataLimitInMegabytes uint32
}type
NLM_SIMULATED_PROFILE_INFO = record
ProfileName: array[0..255] of WideChar;
cost: Integer;
UsageInMegabytes: DWORD;
DataLimitInMegabytes: DWORD;
end;const NLM_SIMULATED_PROFILE_INFO = extern struct {
ProfileName: [256]u16,
cost: i32,
UsageInMegabytes: u32,
DataLimitInMegabytes: u32,
};type
NLM_SIMULATED_PROFILE_INFO {.bycopy.} = object
ProfileName: array[256, uint16]
cost: int32
UsageInMegabytes: uint32
DataLimitInMegabytes: uint32struct NLM_SIMULATED_PROFILE_INFO
{
wchar[256] ProfileName;
int cost;
uint UsageInMegabytes;
uint DataLimitInMegabytes;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; NLM_SIMULATED_PROFILE_INFO サイズ: 524 バイト(x64)
dim st, 131 ; 4byte整数×131(構造体サイズ 524 / 4 切り上げ)
; ProfileName : WCHAR (+0, 512byte) varptr(st)+0 を基点に操作(512byte:入れ子/配列)
; cost : NLM_CONNECTION_COST (+512, 4byte) st.128 = 値 / 値 = st.128 (lpoke/lpeek も可)
; UsageInMegabytes : DWORD (+516, 4byte) st.129 = 値 / 値 = st.129 (lpoke/lpeek も可)
; DataLimitInMegabytes : DWORD (+520, 4byte) st.130 = 値 / 値 = st.130 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global NLM_SIMULATED_PROFILE_INFO
#field wchar ProfileName 256
#field int cost
#field int UsageInMegabytes
#field int DataLimitInMegabytes
#endstruct
stdim st, NLM_SIMULATED_PROFILE_INFO ; NSTRUCT 変数を確保
st->cost = 100
mes "cost=" + st->cost