ホーム › Media.MediaFoundation › MFGetAttributesAsBlob
MFGetAttributesAsBlob
関数属性ストアの内容をBLOB形式で書き出す。
シグネチャ
// MFPlat.dll
#include <windows.h>
HRESULT MFGetAttributesAsBlob(
IMFAttributes* pAttributes,
BYTE* pBuf,
DWORD cbBufSize
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| pAttributes | IMFAttributes* | in | シリアライズする対象の IMFAttributes ポインタ。 |
| pBuf | BYTE* | out | シリアライズ結果を書き込むバイトバッファへのポインタ。 |
| cbBufSize | DWORD | in | pBuf バッファのバイト数。必要サイズ以上を指定する。 |
戻り値の型: HRESULT
各言語での呼び出し定義
// MFPlat.dll
#include <windows.h>
HRESULT MFGetAttributesAsBlob(
IMFAttributes* pAttributes,
BYTE* pBuf,
DWORD cbBufSize
);[DllImport("MFPlat.dll", ExactSpelling = true)]
static extern int MFGetAttributesAsBlob(
IntPtr pAttributes, // IMFAttributes*
IntPtr pBuf, // BYTE* out
uint cbBufSize // DWORD
);<DllImport("MFPlat.dll", ExactSpelling:=True)>
Public Shared Function MFGetAttributesAsBlob(
pAttributes As IntPtr, ' IMFAttributes*
pBuf As IntPtr, ' BYTE* out
cbBufSize As UInteger ' DWORD
) As Integer
End Function' pAttributes : IMFAttributes*
' pBuf : BYTE* out
' cbBufSize : DWORD
Declare PtrSafe Function MFGetAttributesAsBlob Lib "mfplat" ( _
ByVal pAttributes As LongPtr, _
ByVal pBuf As LongPtr, _
ByVal cbBufSize As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
MFGetAttributesAsBlob = ctypes.windll.mfplat.MFGetAttributesAsBlob
MFGetAttributesAsBlob.restype = ctypes.c_int
MFGetAttributesAsBlob.argtypes = [
ctypes.c_void_p, # pAttributes : IMFAttributes*
ctypes.POINTER(ctypes.c_ubyte), # pBuf : BYTE* out
wintypes.DWORD, # cbBufSize : DWORD
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('MFPlat.dll')
MFGetAttributesAsBlob = Fiddle::Function.new(
lib['MFGetAttributesAsBlob'],
[
Fiddle::TYPE_VOIDP, # pAttributes : IMFAttributes*
Fiddle::TYPE_VOIDP, # pBuf : BYTE* out
-Fiddle::TYPE_INT, # cbBufSize : DWORD
],
Fiddle::TYPE_INT)#[link(name = "mfplat")]
extern "system" {
fn MFGetAttributesAsBlob(
pAttributes: *mut core::ffi::c_void, // IMFAttributes*
pBuf: *mut u8, // BYTE* out
cbBufSize: u32 // DWORD
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("MFPlat.dll")]
public static extern int MFGetAttributesAsBlob(IntPtr pAttributes, IntPtr pBuf, uint cbBufSize);
"@
$api = Add-Type -MemberDefinition $sig -Name 'MFPlat_MFGetAttributesAsBlob' -Namespace Win32 -PassThru
# $api::MFGetAttributesAsBlob(pAttributes, pBuf, cbBufSize)#uselib "MFPlat.dll"
#func global MFGetAttributesAsBlob "MFGetAttributesAsBlob" sptr, sptr, sptr
; MFGetAttributesAsBlob pAttributes, varptr(pBuf), cbBufSize ; 戻り値は stat
; pAttributes : IMFAttributes* -> "sptr"
; pBuf : BYTE* out -> "sptr"
; cbBufSize : DWORD -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "MFPlat.dll" #cfunc global MFGetAttributesAsBlob "MFGetAttributesAsBlob" sptr, var, int ; res = MFGetAttributesAsBlob(pAttributes, pBuf, cbBufSize) ; pAttributes : IMFAttributes* -> "sptr" ; pBuf : BYTE* out -> "var" ; cbBufSize : DWORD -> "int" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "MFPlat.dll" #cfunc global MFGetAttributesAsBlob "MFGetAttributesAsBlob" sptr, sptr, int ; res = MFGetAttributesAsBlob(pAttributes, varptr(pBuf), cbBufSize) ; pAttributes : IMFAttributes* -> "sptr" ; pBuf : BYTE* out -> "sptr" ; cbBufSize : DWORD -> "int" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; HRESULT MFGetAttributesAsBlob(IMFAttributes* pAttributes, BYTE* pBuf, DWORD cbBufSize) #uselib "MFPlat.dll" #cfunc global MFGetAttributesAsBlob "MFGetAttributesAsBlob" intptr, var, int ; res = MFGetAttributesAsBlob(pAttributes, pBuf, cbBufSize) ; pAttributes : IMFAttributes* -> "intptr" ; pBuf : BYTE* out -> "var" ; cbBufSize : DWORD -> "int" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; HRESULT MFGetAttributesAsBlob(IMFAttributes* pAttributes, BYTE* pBuf, DWORD cbBufSize) #uselib "MFPlat.dll" #cfunc global MFGetAttributesAsBlob "MFGetAttributesAsBlob" intptr, intptr, int ; res = MFGetAttributesAsBlob(pAttributes, varptr(pBuf), cbBufSize) ; pAttributes : IMFAttributes* -> "intptr" ; pBuf : BYTE* out -> "intptr" ; cbBufSize : DWORD -> "int" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
mfplat = windows.NewLazySystemDLL("MFPlat.dll")
procMFGetAttributesAsBlob = mfplat.NewProc("MFGetAttributesAsBlob")
)
// pAttributes (IMFAttributes*), pBuf (BYTE* out), cbBufSize (DWORD)
r1, _, err := procMFGetAttributesAsBlob.Call(
uintptr(pAttributes),
uintptr(pBuf),
uintptr(cbBufSize),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HRESULTfunction MFGetAttributesAsBlob(
pAttributes: Pointer; // IMFAttributes*
pBuf: Pointer; // BYTE* out
cbBufSize: DWORD // DWORD
): Integer; stdcall;
external 'MFPlat.dll' name 'MFGetAttributesAsBlob';result := DllCall("MFPlat\MFGetAttributesAsBlob"
, "Ptr", pAttributes ; IMFAttributes*
, "Ptr", pBuf ; BYTE* out
, "UInt", cbBufSize ; DWORD
, "Int") ; return: HRESULT●MFGetAttributesAsBlob(pAttributes, pBuf, cbBufSize) = DLL("MFPlat.dll", "int MFGetAttributesAsBlob(void*, void*, dword)")
# 呼び出し: MFGetAttributesAsBlob(pAttributes, pBuf, cbBufSize)
# pAttributes : IMFAttributes* -> "void*"
# pBuf : BYTE* out -> "void*"
# cbBufSize : DWORD -> "dword"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。