Win32 API 日本語リファレンス
ホームMedia.KernelStreaming › KSTOPOLOGY

KSTOPOLOGY

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

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

フィールド

フィールドサイズx64x86説明
CategoriesCountDWORD4+0+0Categories配列の要素数を示す。
CategoriesGUID*8/4+8+4カテゴリGUID配列へのポインタ。フィルタのカテゴリ群を指す。
TopologyNodesCountDWORD4+16+8TopologyNodes配列の要素数(ノード数)を示す。
TopologyNodesGUID*8/4+24+12ノード種別GUID配列へのポインタ。各トポロジノードを指す。
TopologyConnectionsCountDWORD4+32+16TopologyConnections配列の要素数(接続数)を示す。
TopologyConnectionsKSTOPOLOGY_CONNECTION*8/4+40+20ノード間接続(KSTOPOLOGY_CONNECTION)配列へのポインタ。
TopologyNodesNamesGUID*8/4+48+24ノード名GUID配列へのポインタ。各ノードの名称リソースを指す。
ReservedDWORD4+56+28予約領域。将来拡張用で通常は0とする。

各言語での定義

#include <windows.h>

// KSTOPOLOGY  (x64 64 / x86 32 バイト)
typedef struct KSTOPOLOGY {
    DWORD CategoriesCount;
    GUID* Categories;
    DWORD TopologyNodesCount;
    GUID* TopologyNodes;
    DWORD TopologyConnectionsCount;
    KSTOPOLOGY_CONNECTION* TopologyConnections;
    GUID* TopologyNodesNames;
    DWORD Reserved;
} KSTOPOLOGY;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct KSTOPOLOGY
{
    public uint CategoriesCount;
    public IntPtr Categories;
    public uint TopologyNodesCount;
    public IntPtr TopologyNodes;
    public uint TopologyConnectionsCount;
    public IntPtr TopologyConnections;
    public IntPtr TopologyNodesNames;
    public uint Reserved;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure KSTOPOLOGY
    Public CategoriesCount As UInteger
    Public Categories As IntPtr
    Public TopologyNodesCount As UInteger
    Public TopologyNodes As IntPtr
    Public TopologyConnectionsCount As UInteger
    Public TopologyConnections As IntPtr
    Public TopologyNodesNames As IntPtr
    Public Reserved As UInteger
End Structure
import ctypes
from ctypes import wintypes

class KSTOPOLOGY(ctypes.Structure):
    _fields_ = [
        ("CategoriesCount", wintypes.DWORD),
        ("Categories", ctypes.c_void_p),
        ("TopologyNodesCount", wintypes.DWORD),
        ("TopologyNodes", ctypes.c_void_p),
        ("TopologyConnectionsCount", wintypes.DWORD),
        ("TopologyConnections", ctypes.c_void_p),
        ("TopologyNodesNames", ctypes.c_void_p),
        ("Reserved", wintypes.DWORD),
    ]
#[repr(C)]
pub struct KSTOPOLOGY {
    pub CategoriesCount: u32,
    pub Categories: *mut core::ffi::c_void,
    pub TopologyNodesCount: u32,
    pub TopologyNodes: *mut core::ffi::c_void,
    pub TopologyConnectionsCount: u32,
    pub TopologyConnections: *mut core::ffi::c_void,
    pub TopologyNodesNames: *mut core::ffi::c_void,
    pub Reserved: u32,
}
import "golang.org/x/sys/windows"

type KSTOPOLOGY struct {
	CategoriesCount uint32
	Categories uintptr
	TopologyNodesCount uint32
	TopologyNodes uintptr
	TopologyConnectionsCount uint32
	TopologyConnections uintptr
	TopologyNodesNames uintptr
	Reserved uint32
}
type
  KSTOPOLOGY = record
    CategoriesCount: DWORD;
    Categories: Pointer;
    TopologyNodesCount: DWORD;
    TopologyNodes: Pointer;
    TopologyConnectionsCount: DWORD;
    TopologyConnections: Pointer;
    TopologyNodesNames: Pointer;
    Reserved: DWORD;
  end;
const KSTOPOLOGY = extern struct {
    CategoriesCount: u32,
    Categories: ?*anyopaque,
    TopologyNodesCount: u32,
    TopologyNodes: ?*anyopaque,
    TopologyConnectionsCount: u32,
    TopologyConnections: ?*anyopaque,
    TopologyNodesNames: ?*anyopaque,
    Reserved: u32,
};
type
  KSTOPOLOGY {.bycopy.} = object
    CategoriesCount: uint32
    Categories: pointer
    TopologyNodesCount: uint32
    TopologyNodes: pointer
    TopologyConnectionsCount: uint32
    TopologyConnections: pointer
    TopologyNodesNames: pointer
    Reserved: uint32
struct KSTOPOLOGY
{
    uint CategoriesCount;
    void* Categories;
    uint TopologyNodesCount;
    void* TopologyNodes;
    uint TopologyConnectionsCount;
    void* TopologyConnections;
    void* TopologyNodesNames;
    uint Reserved;
}

HSP用 定義

HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; KSTOPOLOGY サイズ: 32 バイト(x86)
dim st, 8    ; 4byte整数×8(構造体サイズ 32 / 4 切り上げ)
; CategoriesCount : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; Categories : GUID* (+4, 4byte)  varptr(st)+4 を基点に操作(4byte:入れ子/配列)
; TopologyNodesCount : DWORD (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; TopologyNodes : GUID* (+12, 4byte)  varptr(st)+12 を基点に操作(4byte:入れ子/配列)
; TopologyConnectionsCount : DWORD (+16, 4byte)  st.4 = 値  /  値 = st.4   (lpoke/lpeek も可)
; TopologyConnections : KSTOPOLOGY_CONNECTION* (+20, 4byte)  varptr(st)+20 を基点に操作(4byte:入れ子/配列)
; TopologyNodesNames : GUID* (+24, 4byte)  varptr(st)+24 を基点に操作(4byte:入れ子/配列)
; Reserved : DWORD (+28, 4byte)  st.7 = 値  /  値 = st.7   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; KSTOPOLOGY サイズ: 64 バイト(x64)
dim st, 16    ; 4byte整数×16(構造体サイズ 64 / 4 切り上げ)
; CategoriesCount : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; Categories : GUID* (+8, 8byte)  varptr(st)+8 を基点に操作(8byte:入れ子/配列)
; TopologyNodesCount : DWORD (+16, 4byte)  st.4 = 値  /  値 = st.4   (lpoke/lpeek も可)
; TopologyNodes : GUID* (+24, 8byte)  varptr(st)+24 を基点に操作(8byte:入れ子/配列)
; TopologyConnectionsCount : DWORD (+32, 4byte)  st.8 = 値  /  値 = st.8   (lpoke/lpeek も可)
; TopologyConnections : KSTOPOLOGY_CONNECTION* (+40, 8byte)  varptr(st)+40 を基点に操作(8byte:入れ子/配列)
; TopologyNodesNames : GUID* (+48, 8byte)  varptr(st)+48 を基点に操作(8byte:入れ子/配列)
; Reserved : DWORD (+56, 4byte)  st.14 = 値  /  値 = st.14   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global KSTOPOLOGY
    #field int CategoriesCount
    #field intptr Categories
    #field int TopologyNodesCount
    #field intptr TopologyNodes
    #field int TopologyConnectionsCount
    #field intptr TopologyConnections
    #field intptr TopologyNodesNames
    #field int Reserved
#endstruct

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