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

KsResolveRequiredAttributes

関数
データ範囲に対し必須の属性を解決し適合性を検証する。
DLLksproxy.ax呼出規約winapi

シグネチャ

// ksproxy.ax
#include <windows.h>

HRESULT KsResolveRequiredAttributes(
    KSDATAFORMAT* DataRange,
    KSMULTIPLE_ITEM* Attributes   // optional
);

パラメーター

名前方向説明
DataRangeKSDATAFORMAT*in検証対象のデータ範囲を示すKSDATAFORMAT構造体へのポインター。
AttributesKSMULTIPLE_ITEM*inoptional必要属性の集合を示すKSMULTIPLE_ITEM構造体へのポインター。DataRangeが満たすか確認する。

戻り値の型: HRESULT

各言語での呼び出し定義

// ksproxy.ax
#include <windows.h>

HRESULT KsResolveRequiredAttributes(
    KSDATAFORMAT* DataRange,
    KSMULTIPLE_ITEM* Attributes   // optional
);
[DllImport("ksproxy.ax", ExactSpelling = true)]
static extern int KsResolveRequiredAttributes(
    IntPtr DataRange,   // KSDATAFORMAT*
    IntPtr Attributes   // KSMULTIPLE_ITEM* optional
);
<DllImport("ksproxy.ax", ExactSpelling:=True)>
Public Shared Function KsResolveRequiredAttributes(
    DataRange As IntPtr,   ' KSDATAFORMAT*
    Attributes As IntPtr   ' KSMULTIPLE_ITEM* optional
) As Integer
End Function
' DataRange : KSDATAFORMAT*
' Attributes : KSMULTIPLE_ITEM* optional
Declare PtrSafe Function KsResolveRequiredAttributes Lib "ksproxy.ax" ( _
    ByVal DataRange As LongPtr, _
    ByVal Attributes As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

KsResolveRequiredAttributes = ctypes.windll.LoadLibrary("ksproxy.ax").KsResolveRequiredAttributes
KsResolveRequiredAttributes.restype = ctypes.c_int
KsResolveRequiredAttributes.argtypes = [
    ctypes.c_void_p,  # DataRange : KSDATAFORMAT*
    ctypes.c_void_p,  # Attributes : KSMULTIPLE_ITEM* optional
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('ksproxy.ax')
KsResolveRequiredAttributes = Fiddle::Function.new(
  lib['KsResolveRequiredAttributes'],
  [
    Fiddle::TYPE_VOIDP,  # DataRange : KSDATAFORMAT*
    Fiddle::TYPE_VOIDP,  # Attributes : KSMULTIPLE_ITEM* optional
  ],
  Fiddle::TYPE_INT)
#[link(name = "ksproxy.ax")]
extern "system" {
    fn KsResolveRequiredAttributes(
        DataRange: *mut KSDATAFORMAT,  // KSDATAFORMAT*
        Attributes: *mut KSMULTIPLE_ITEM  // KSMULTIPLE_ITEM* optional
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("ksproxy.ax")]
public static extern int KsResolveRequiredAttributes(IntPtr DataRange, IntPtr Attributes);
"@
$api = Add-Type -MemberDefinition $sig -Name 'ksproxy.ax_KsResolveRequiredAttributes' -Namespace Win32 -PassThru
# $api::KsResolveRequiredAttributes(DataRange, Attributes)
#uselib "ksproxy.ax"
#func global KsResolveRequiredAttributes "KsResolveRequiredAttributes" sptr, sptr
; KsResolveRequiredAttributes varptr(DataRange), varptr(Attributes)   ; 戻り値は stat
; DataRange : KSDATAFORMAT* -> "sptr"
; Attributes : KSMULTIPLE_ITEM* optional -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "ksproxy.ax"
#cfunc global KsResolveRequiredAttributes "KsResolveRequiredAttributes" var, var
; res = KsResolveRequiredAttributes(DataRange, Attributes)
; DataRange : KSDATAFORMAT* -> "var"
; Attributes : KSMULTIPLE_ITEM* optional -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; HRESULT KsResolveRequiredAttributes(KSDATAFORMAT* DataRange, KSMULTIPLE_ITEM* Attributes)
#uselib "ksproxy.ax"
#cfunc global KsResolveRequiredAttributes "KsResolveRequiredAttributes" var, var
; res = KsResolveRequiredAttributes(DataRange, Attributes)
; DataRange : KSDATAFORMAT* -> "var"
; Attributes : KSMULTIPLE_ITEM* optional -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	ksproxy_ax = windows.NewLazySystemDLL("ksproxy.ax")
	procKsResolveRequiredAttributes = ksproxy_ax.NewProc("KsResolveRequiredAttributes")
)

// DataRange (KSDATAFORMAT*), Attributes (KSMULTIPLE_ITEM* optional)
r1, _, err := procKsResolveRequiredAttributes.Call(
	uintptr(DataRange),
	uintptr(Attributes),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // HRESULT
function KsResolveRequiredAttributes(
  DataRange: Pointer;   // KSDATAFORMAT*
  Attributes: Pointer   // KSMULTIPLE_ITEM* optional
): Integer; stdcall;
  external 'ksproxy.ax' name 'KsResolveRequiredAttributes';
result := DllCall("ksproxy.ax\KsResolveRequiredAttributes"
    , "Ptr", DataRange   ; KSDATAFORMAT*
    , "Ptr", Attributes   ; KSMULTIPLE_ITEM* optional
    , "Int")   ; return: HRESULT
●KsResolveRequiredAttributes(DataRange, Attributes) = DLL("ksproxy.ax", "int KsResolveRequiredAttributes(void*, void*)")
# 呼び出し: KsResolveRequiredAttributes(DataRange, Attributes)
# DataRange : KSDATAFORMAT* -> "void*"
# Attributes : KSMULTIPLE_ITEM* optional -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
const std = @import("std");

extern "ksproxy.ax" fn KsResolveRequiredAttributes(
    DataRange: [*c]KSDATAFORMAT, // KSDATAFORMAT*
    Attributes: [*c]KSMULTIPLE_ITEM // KSMULTIPLE_ITEM* optional
) callconv(std.os.windows.WINAPI) i32;
proc KsResolveRequiredAttributes(
    DataRange: ptr KSDATAFORMAT,  # KSDATAFORMAT*
    Attributes: ptr KSMULTIPLE_ITEM  # KSMULTIPLE_ITEM* optional
): int32 {.importc: "KsResolveRequiredAttributes", stdcall, dynlib: "ksproxy.ax".}
pragma(lib, "ksproxy.ax");
extern(Windows)
int KsResolveRequiredAttributes(
    KSDATAFORMAT* DataRange,   // KSDATAFORMAT*
    KSMULTIPLE_ITEM* Attributes   // KSMULTIPLE_ITEM* optional
);
ccall((:KsResolveRequiredAttributes, "ksproxy.ax"), stdcall, Int32,
      (Ptr{KSDATAFORMAT}, Ptr{KSMULTIPLE_ITEM}),
      DataRange, Attributes)
# DataRange : KSDATAFORMAT* -> Ptr{KSDATAFORMAT}
# Attributes : KSMULTIPLE_ITEM* optional -> Ptr{KSMULTIPLE_ITEM}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。
local ffi = require("ffi")
ffi.cdef[[
int32_t KsResolveRequiredAttributes(
    void* DataRange,
    void* Attributes);
]]
local ksproxy.ax = ffi.load("ksproxy.ax")
-- ksproxy.ax.KsResolveRequiredAttributes(DataRange, Attributes)
-- DataRange : KSDATAFORMAT*
-- Attributes : KSMULTIPLE_ITEM* optional
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
const koffi = require('koffi');
const lib = koffi.load('ksproxy.ax');
const KsResolveRequiredAttributes = lib.func('__stdcall', 'KsResolveRequiredAttributes', 'int32_t', ['void *', 'void *']);
// KsResolveRequiredAttributes(DataRange, Attributes)
// DataRange : KSDATAFORMAT* -> 'void *'
// Attributes : KSMULTIPLE_ITEM* optional -> 'void *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
const lib = Deno.dlopen("ksproxy.ax", {
  KsResolveRequiredAttributes: { parameters: ["pointer", "pointer"], result: "i32" },
});
// lib.symbols.KsResolveRequiredAttributes(DataRange, Attributes)
// DataRange : KSDATAFORMAT* -> "pointer"
// Attributes : KSMULTIPLE_ITEM* optional -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。
<?php
$ffi = FFI::cdef(<<<C
int32_t KsResolveRequiredAttributes(
    void* DataRange,
    void* Attributes);
C, "ksproxy.ax");
// $ffi->KsResolveRequiredAttributes(DataRange, Attributes);
// DataRange : KSDATAFORMAT*
// Attributes : KSMULTIPLE_ITEM* optional
// 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
// WINAPI(stdcall): x64 では呼出規約が統一されるため問題なし。x86 では __stdcall 対応のラッパが必要な場合あり。
import com.sun.jna.*;
import com.sun.jna.ptr.*;
import com.sun.jna.win32.StdCallLibrary;
import com.sun.jna.win32.W32APIOptions;

public interface Ksproxy.ax extends StdCallLibrary {
    Ksproxy.ax INSTANCE = Native.load("ksproxy.ax", Ksproxy.ax.class);
    int KsResolveRequiredAttributes(
        Pointer DataRange,   // KSDATAFORMAT*
        Pointer Attributes   // KSMULTIPLE_ITEM* optional
    );
}
@[Link("ksproxy.ax")]
lib Libksproxy.ax
  fun KsResolveRequiredAttributes = KsResolveRequiredAttributes(
    DataRange : KSDATAFORMAT*,   # KSDATAFORMAT*
    Attributes : KSMULTIPLE_ITEM*   # KSMULTIPLE_ITEM* optional
  ) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。
import 'dart:ffi';
import 'package:ffi/ffi.dart';

typedef KsResolveRequiredAttributesNative = Int32 Function(Pointer<Void>, Pointer<Void>);
typedef KsResolveRequiredAttributesDart = int Function(Pointer<Void>, Pointer<Void>);
final KsResolveRequiredAttributes = DynamicLibrary.open('ksproxy.ax')
    .lookupFunction<KsResolveRequiredAttributesNative, KsResolveRequiredAttributesDart>('KsResolveRequiredAttributes');
// DataRange : KSDATAFORMAT* -> Pointer<Void>
// Attributes : KSMULTIPLE_ITEM* optional -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
function KsResolveRequiredAttributes(
  DataRange: Pointer;   // KSDATAFORMAT*
  Attributes: Pointer   // KSMULTIPLE_ITEM* optional
): Integer; stdcall;
  external 'ksproxy.ax' name 'KsResolveRequiredAttributes';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import stdcall safe "KsResolveRequiredAttributes"
  c_KsResolveRequiredAttributes :: Ptr () -> Ptr () -> IO Int32
-- DataRange : KSDATAFORMAT* -> Ptr ()
-- Attributes : KSMULTIPLE_ITEM* optional -> Ptr ()
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let ksresolverequiredattributes =
  foreign "KsResolveRequiredAttributes"
    ((ptr void) @-> (ptr void) @-> returning int32_t)
(* DataRange : KSDATAFORMAT* -> (ptr void) *)
(* Attributes : KSMULTIPLE_ITEM* optional -> (ptr void) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)
(cffi:define-foreign-library ksproxy.ax (t "ksproxy.ax"))
(cffi:use-foreign-library ksproxy.ax)

(cffi:defcfun ("KsResolveRequiredAttributes" ks-resolve-required-attributes :convention :stdcall) :int32
  (data-range :pointer)   ; KSDATAFORMAT*
  (attributes :pointer))   ; KSMULTIPLE_ITEM* optional
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $KsResolveRequiredAttributes = Win32::API::More->new('ksproxy.ax',
    'int KsResolveRequiredAttributes(LPVOID DataRange, LPVOID Attributes)');
# my $ret = $KsResolveRequiredAttributes->Call($DataRange, $Attributes);
# DataRange : KSDATAFORMAT* -> LPVOID
# Attributes : KSMULTIPLE_ITEM* optional -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。

関連項目

使用する型