ホーム › Media.MediaFoundation › MFGetAttributesAsBlobSize
MFGetAttributesAsBlobSize
関数属性ストアをBLOB化するのに必要なサイズを取得する。
シグネチャ
// MFPlat.dll
#include <windows.h>
HRESULT MFGetAttributesAsBlobSize(
IMFAttributes* pAttributes,
DWORD* pcbBufSize
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| pAttributes | IMFAttributes* | in | 属性ストアの IMFAttributes インターフェイスへのポインター。 |
| pcbBufSize | DWORD* | out | 必要な配列のサイズ (バイト単位) を受け取ります。 |
戻り値の型: HRESULT
公式ドキュメント
MFGetAttributesAsBlob 関数に必要なバッファーのサイズを取得します。
戻り値
この関数は HRESULT を返します。指定できる値には次の表の値が含まれますが、これらに限定されません。
| 戻り値 | 説明 |
|---|---|
| 関数が成功しました。 |
解説(Remarks)
MFGetAttributesAsBlob 関数に必要な配列のサイズを調べるには、この関数を使用します。
出典・ライセンス: 上記「公式ドキュメント」の内容は Microsoft の Win32 API ドキュメント(MicrosoftDocs/sdk-api)を日本語に翻訳・改変したものです。© Microsoft Corporation. CC BY 4.0 で提供。
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)
各言語での呼び出し定義
// MFPlat.dll
#include <windows.h>
HRESULT MFGetAttributesAsBlobSize(
IMFAttributes* pAttributes,
DWORD* pcbBufSize
);[DllImport("MFPlat.dll", ExactSpelling = true)]
static extern int MFGetAttributesAsBlobSize(
IntPtr pAttributes, // IMFAttributes*
out uint pcbBufSize // DWORD* out
);<DllImport("MFPlat.dll", ExactSpelling:=True)>
Public Shared Function MFGetAttributesAsBlobSize(
pAttributes As IntPtr, ' IMFAttributes*
<Out> ByRef pcbBufSize As UInteger ' DWORD* out
) As Integer
End Function' pAttributes : IMFAttributes*
' pcbBufSize : DWORD* out
Declare PtrSafe Function MFGetAttributesAsBlobSize Lib "mfplat" ( _
ByVal pAttributes As LongPtr, _
ByRef pcbBufSize As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
MFGetAttributesAsBlobSize = ctypes.windll.mfplat.MFGetAttributesAsBlobSize
MFGetAttributesAsBlobSize.restype = ctypes.c_int
MFGetAttributesAsBlobSize.argtypes = [
ctypes.c_void_p, # pAttributes : IMFAttributes*
ctypes.POINTER(wintypes.DWORD), # pcbBufSize : DWORD* out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('MFPlat.dll')
MFGetAttributesAsBlobSize = Fiddle::Function.new(
lib['MFGetAttributesAsBlobSize'],
[
Fiddle::TYPE_VOIDP, # pAttributes : IMFAttributes*
Fiddle::TYPE_VOIDP, # pcbBufSize : DWORD* out
],
Fiddle::TYPE_INT)#[link(name = "mfplat")]
extern "system" {
fn MFGetAttributesAsBlobSize(
pAttributes: *mut core::ffi::c_void, // IMFAttributes*
pcbBufSize: *mut u32 // DWORD* out
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("MFPlat.dll")]
public static extern int MFGetAttributesAsBlobSize(IntPtr pAttributes, out uint pcbBufSize);
"@
$api = Add-Type -MemberDefinition $sig -Name 'MFPlat_MFGetAttributesAsBlobSize' -Namespace Win32 -PassThru
# $api::MFGetAttributesAsBlobSize(pAttributes, pcbBufSize)#uselib "MFPlat.dll"
#func global MFGetAttributesAsBlobSize "MFGetAttributesAsBlobSize" sptr, sptr
; MFGetAttributesAsBlobSize pAttributes, varptr(pcbBufSize) ; 戻り値は stat
; pAttributes : IMFAttributes* -> "sptr"
; pcbBufSize : DWORD* out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "MFPlat.dll" #cfunc global MFGetAttributesAsBlobSize "MFGetAttributesAsBlobSize" sptr, var ; res = MFGetAttributesAsBlobSize(pAttributes, pcbBufSize) ; pAttributes : IMFAttributes* -> "sptr" ; pcbBufSize : DWORD* out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "MFPlat.dll" #cfunc global MFGetAttributesAsBlobSize "MFGetAttributesAsBlobSize" sptr, sptr ; res = MFGetAttributesAsBlobSize(pAttributes, varptr(pcbBufSize)) ; pAttributes : IMFAttributes* -> "sptr" ; pcbBufSize : DWORD* out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; HRESULT MFGetAttributesAsBlobSize(IMFAttributes* pAttributes, DWORD* pcbBufSize) #uselib "MFPlat.dll" #cfunc global MFGetAttributesAsBlobSize "MFGetAttributesAsBlobSize" intptr, var ; res = MFGetAttributesAsBlobSize(pAttributes, pcbBufSize) ; pAttributes : IMFAttributes* -> "intptr" ; pcbBufSize : DWORD* out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; HRESULT MFGetAttributesAsBlobSize(IMFAttributes* pAttributes, DWORD* pcbBufSize) #uselib "MFPlat.dll" #cfunc global MFGetAttributesAsBlobSize "MFGetAttributesAsBlobSize" intptr, intptr ; res = MFGetAttributesAsBlobSize(pAttributes, varptr(pcbBufSize)) ; pAttributes : IMFAttributes* -> "intptr" ; pcbBufSize : DWORD* out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
mfplat = windows.NewLazySystemDLL("MFPlat.dll")
procMFGetAttributesAsBlobSize = mfplat.NewProc("MFGetAttributesAsBlobSize")
)
// pAttributes (IMFAttributes*), pcbBufSize (DWORD* out)
r1, _, err := procMFGetAttributesAsBlobSize.Call(
uintptr(pAttributes),
uintptr(pcbBufSize),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HRESULTfunction MFGetAttributesAsBlobSize(
pAttributes: Pointer; // IMFAttributes*
pcbBufSize: Pointer // DWORD* out
): Integer; stdcall;
external 'MFPlat.dll' name 'MFGetAttributesAsBlobSize';result := DllCall("MFPlat\MFGetAttributesAsBlobSize"
, "Ptr", pAttributes ; IMFAttributes*
, "Ptr", pcbBufSize ; DWORD* out
, "Int") ; return: HRESULT●MFGetAttributesAsBlobSize(pAttributes, pcbBufSize) = DLL("MFPlat.dll", "int MFGetAttributesAsBlobSize(void*, void*)")
# 呼び出し: MFGetAttributesAsBlobSize(pAttributes, pcbBufSize)
# pAttributes : IMFAttributes* -> "void*"
# pcbBufSize : DWORD* out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。const std = @import("std");
extern "mfplat" fn MFGetAttributesAsBlobSize(
pAttributes: ?*anyopaque, // IMFAttributes*
pcbBufSize: [*c]u32 // DWORD* out
) callconv(std.os.windows.WINAPI) i32;proc MFGetAttributesAsBlobSize(
pAttributes: pointer, # IMFAttributes*
pcbBufSize: ptr uint32 # DWORD* out
): int32 {.importc: "MFGetAttributesAsBlobSize", stdcall, dynlib: "MFPlat.dll".}pragma(lib, "mfplat");
extern(Windows)
int MFGetAttributesAsBlobSize(
void* pAttributes, // IMFAttributes*
uint* pcbBufSize // DWORD* out
);ccall((:MFGetAttributesAsBlobSize, "MFPlat.dll"), stdcall, Int32,
(Ptr{Cvoid}, Ptr{UInt32}),
pAttributes, pcbBufSize)
# pAttributes : IMFAttributes* -> Ptr{Cvoid}
# pcbBufSize : DWORD* out -> Ptr{UInt32}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
int32_t MFGetAttributesAsBlobSize(
void* pAttributes,
uint32_t* pcbBufSize);
]]
local mfplat = ffi.load("mfplat")
-- mfplat.MFGetAttributesAsBlobSize(pAttributes, pcbBufSize)
-- pAttributes : IMFAttributes*
-- pcbBufSize : DWORD* out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('MFPlat.dll');
const MFGetAttributesAsBlobSize = lib.func('__stdcall', 'MFGetAttributesAsBlobSize', 'int32_t', ['void *', 'uint32_t *']);
// MFGetAttributesAsBlobSize(pAttributes, pcbBufSize)
// pAttributes : IMFAttributes* -> 'void *'
// pcbBufSize : DWORD* out -> 'uint32_t *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("MFPlat.dll", {
MFGetAttributesAsBlobSize: { parameters: ["pointer", "pointer"], result: "i32" },
});
// lib.symbols.MFGetAttributesAsBlobSize(pAttributes, pcbBufSize)
// pAttributes : IMFAttributes* -> "pointer"
// pcbBufSize : DWORD* out -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
int32_t MFGetAttributesAsBlobSize(
void* pAttributes,
uint32_t* pcbBufSize);
C, "MFPlat.dll");
// $ffi->MFGetAttributesAsBlobSize(pAttributes, pcbBufSize);
// pAttributes : IMFAttributes*
// pcbBufSize : DWORD* out
// 構造体/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 Mfplat extends StdCallLibrary {
Mfplat INSTANCE = Native.load("mfplat", Mfplat.class);
int MFGetAttributesAsBlobSize(
Pointer pAttributes, // IMFAttributes*
IntByReference pcbBufSize // DWORD* out
);
}@[Link("mfplat")]
lib LibMFPlat
fun MFGetAttributesAsBlobSize = MFGetAttributesAsBlobSize(
pAttributes : Void*, # IMFAttributes*
pcbBufSize : UInt32* # DWORD* out
) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef MFGetAttributesAsBlobSizeNative = Int32 Function(Pointer<Void>, Pointer<Uint32>);
typedef MFGetAttributesAsBlobSizeDart = int Function(Pointer<Void>, Pointer<Uint32>);
final MFGetAttributesAsBlobSize = DynamicLibrary.open('MFPlat.dll')
.lookupFunction<MFGetAttributesAsBlobSizeNative, MFGetAttributesAsBlobSizeDart>('MFGetAttributesAsBlobSize');
// pAttributes : IMFAttributes* -> Pointer<Void>
// pcbBufSize : DWORD* out -> Pointer<Uint32>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function MFGetAttributesAsBlobSize(
pAttributes: Pointer; // IMFAttributes*
pcbBufSize: Pointer // DWORD* out
): Integer; stdcall;
external 'MFPlat.dll' name 'MFGetAttributesAsBlobSize';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "MFGetAttributesAsBlobSize"
c_MFGetAttributesAsBlobSize :: Ptr () -> Ptr Word32 -> IO Int32
-- pAttributes : IMFAttributes* -> Ptr ()
-- pcbBufSize : DWORD* out -> Ptr Word32
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let mfgetattributesasblobsize =
foreign "MFGetAttributesAsBlobSize"
((ptr void) @-> (ptr uint32_t) @-> returning int32_t)
(* pAttributes : IMFAttributes* -> (ptr void) *)
(* pcbBufSize : DWORD* out -> (ptr uint32_t) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library mfplat (t "MFPlat.dll"))
(cffi:use-foreign-library mfplat)
(cffi:defcfun ("MFGetAttributesAsBlobSize" mfget-attributes-as-blob-size :convention :stdcall) :int32
(p-attributes :pointer) ; IMFAttributes*
(pcb-buf-size :pointer)) ; DWORD* out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $MFGetAttributesAsBlobSize = Win32::API::More->new('MFPlat',
'int MFGetAttributesAsBlobSize(LPVOID pAttributes, LPVOID pcbBufSize)');
# my $ret = $MFGetAttributesAsBlobSize->Call($pAttributes, $pcbBufSize);
# pAttributes : IMFAttributes* -> LPVOID
# pcbBufSize : DWORD* out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。関連項目
使用する型