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

KSPIN_CONNECT

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

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

フィールド

フィールドサイズx64x86説明
InterfaceKSIDENTIFIER8+0+0接続インターフェイス識別子(KSIDENTIFIER)。データ転送方式を示す。
MediumKSIDENTIFIER8+8+8接続メディウム識別子(KSIDENTIFIER)。物理/論理媒体を示す。
PinIdDWORD4+16+16接続するピンの識別子。生成対象ピンを指定する。
PinToHandleHANDLE8/4+24+20接続先ピンのハンドル。直結する相手ピンを指す。NULL可。
PriorityKSPRIORITY8+32+24接続の優先度(KSPRIORITY)。リソース割当の優先順位を示す。

各言語での定義

#include <windows.h>

// KSIDENTIFIER  (x64 8 / x86 8 バイト)
typedef struct KSIDENTIFIER {
    _Anonymous_e__Union Anonymous;
} KSIDENTIFIER;

// KSPRIORITY  (x64 8 / x86 8 バイト)
typedef struct KSPRIORITY {
    DWORD PriorityClass;
    DWORD PrioritySubClass;
} KSPRIORITY;

// KSPIN_CONNECT  (x64 40 / x86 32 バイト)
typedef struct KSPIN_CONNECT {
    KSIDENTIFIER Interface;
    KSIDENTIFIER Medium;
    DWORD PinId;
    HANDLE PinToHandle;
    KSPRIORITY Priority;
} KSPIN_CONNECT;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct KSIDENTIFIER
{
    public _Anonymous_e__Union Anonymous;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct KSPRIORITY
{
    public uint PriorityClass;
    public uint PrioritySubClass;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct KSPIN_CONNECT
{
    public KSIDENTIFIER Interface;
    public KSIDENTIFIER Medium;
    public uint PinId;
    public IntPtr PinToHandle;
    public KSPRIORITY Priority;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure KSIDENTIFIER
    Public Anonymous As _Anonymous_e__Union
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure KSPRIORITY
    Public PriorityClass As UInteger
    Public PrioritySubClass As UInteger
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure KSPIN_CONNECT
    Public Interface As KSIDENTIFIER
    Public Medium As KSIDENTIFIER
    Public PinId As UInteger
    Public PinToHandle As IntPtr
    Public Priority As KSPRIORITY
End Structure
import ctypes
from ctypes import wintypes

class KSIDENTIFIER(ctypes.Structure):
    _fields_ = [
        ("Anonymous", _Anonymous_e__Union),
    ]

class KSPRIORITY(ctypes.Structure):
    _fields_ = [
        ("PriorityClass", wintypes.DWORD),
        ("PrioritySubClass", wintypes.DWORD),
    ]

class KSPIN_CONNECT(ctypes.Structure):
    _fields_ = [
        ("Interface", KSIDENTIFIER),
        ("Medium", KSIDENTIFIER),
        ("PinId", wintypes.DWORD),
        ("PinToHandle", ctypes.c_void_p),
        ("Priority", KSPRIORITY),
    ]
#[repr(C)]
pub struct KSIDENTIFIER {
    pub Anonymous: _Anonymous_e__Union,
}

#[repr(C)]
pub struct KSPRIORITY {
    pub PriorityClass: u32,
    pub PrioritySubClass: u32,
}

#[repr(C)]
pub struct KSPIN_CONNECT {
    pub Interface: KSIDENTIFIER,
    pub Medium: KSIDENTIFIER,
    pub PinId: u32,
    pub PinToHandle: *mut core::ffi::c_void,
    pub Priority: KSPRIORITY,
}
import "golang.org/x/sys/windows"

type KSIDENTIFIER struct {
	Anonymous _Anonymous_e__Union
}

type KSPRIORITY struct {
	PriorityClass uint32
	PrioritySubClass uint32
}

type KSPIN_CONNECT struct {
	Interface KSIDENTIFIER
	Medium KSIDENTIFIER
	PinId uint32
	PinToHandle uintptr
	Priority KSPRIORITY
}
type
  KSIDENTIFIER = record
    Anonymous: _Anonymous_e__Union;
  end;

  KSPRIORITY = record
    PriorityClass: DWORD;
    PrioritySubClass: DWORD;
  end;

  KSPIN_CONNECT = record
    Interface: KSIDENTIFIER;
    Medium: KSIDENTIFIER;
    PinId: DWORD;
    PinToHandle: Pointer;
    Priority: KSPRIORITY;
  end;
const KSIDENTIFIER = extern struct {
    Anonymous: _Anonymous_e__Union,
};

const KSPRIORITY = extern struct {
    PriorityClass: u32,
    PrioritySubClass: u32,
};

const KSPIN_CONNECT = extern struct {
    Interface: KSIDENTIFIER,
    Medium: KSIDENTIFIER,
    PinId: u32,
    PinToHandle: ?*anyopaque,
    Priority: KSPRIORITY,
};
type
  KSIDENTIFIER {.bycopy.} = object
    Anonymous: _Anonymous_e__Union

  KSPRIORITY {.bycopy.} = object
    PriorityClass: uint32
    PrioritySubClass: uint32

  KSPIN_CONNECT {.bycopy.} = object
    Interface: KSIDENTIFIER
    Medium: KSIDENTIFIER
    PinId: uint32
    PinToHandle: pointer
    Priority: KSPRIORITY
struct KSIDENTIFIER
{
    _Anonymous_e__Union Anonymous;
}

struct KSPRIORITY
{
    uint PriorityClass;
    uint PrioritySubClass;
}

struct KSPIN_CONNECT
{
    KSIDENTIFIER Interface;
    KSIDENTIFIER Medium;
    uint PinId;
    void* PinToHandle;
    KSPRIORITY Priority;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; KSPIN_CONNECT サイズ: 32 バイト(x86)
dim st, 8    ; 4byte整数×8(構造体サイズ 32 / 4 切り上げ)
; Interface : KSIDENTIFIER (+0, 8byte)  varptr(st)+0 を基点に操作(8byte:入れ子/配列)
; Medium : KSIDENTIFIER (+8, 8byte)  varptr(st)+8 を基点に操作(8byte:入れ子/配列)
; PinId : DWORD (+16, 4byte)  st.4 = 値  /  値 = st.4   (lpoke/lpeek も可)
; PinToHandle : HANDLE (+20, 4byte)  st.5 = 値  /  値 = st.5   (lpoke/lpeek も可)
; Priority : KSPRIORITY (+24, 8byte)  varptr(st)+24 を基点に操作(8byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; KSPIN_CONNECT サイズ: 40 バイト(x64)
dim st, 10    ; 4byte整数×10(構造体サイズ 40 / 4 切り上げ)
; Interface : KSIDENTIFIER (+0, 8byte)  varptr(st)+0 を基点に操作(8byte:入れ子/配列)
; Medium : KSIDENTIFIER (+8, 8byte)  varptr(st)+8 を基点に操作(8byte:入れ子/配列)
; PinId : DWORD (+16, 4byte)  st.4 = 値  /  値 = st.4   (lpoke/lpeek も可)
; PinToHandle : HANDLE (+24, 8byte)  qpoke st,24,値 / qpeek(st,24)  ※IronHSPのみ。3.7/3.8は lpoke st,24,下位 : lpoke st,28,上位
; Priority : KSPRIORITY (+32, 8byte)  varptr(st)+32 を基点に操作(8byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global KSIDENTIFIER
    #field byte Anonymous 8
#endstruct

#defstruct global KSPRIORITY
    #field int PriorityClass
    #field int PrioritySubClass
#endstruct

#defstruct global KSPIN_CONNECT
    #field KSIDENTIFIER Interface
    #field KSIDENTIFIER Medium
    #field int PinId
    #field intptr PinToHandle
    #field KSPRIORITY Priority
#endstruct

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