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

MFRequireProtectedEnvironment

関数
プレゼンテーションに保護環境が必要かどうかを判定する。
DLLMF.dll呼出規約winapi対応OSWindows Vista 以降

シグネチャ

// MF.dll
#include <windows.h>

HRESULT MFRequireProtectedEnvironment(
    IMFPresentationDescriptor* pPresentationDescriptor
);

パラメーター

名前方向
pPresentationDescriptorIMFPresentationDescriptor*in

戻り値の型: HRESULT

各言語での呼び出し定義

// MF.dll
#include <windows.h>

HRESULT MFRequireProtectedEnvironment(
    IMFPresentationDescriptor* pPresentationDescriptor
);
[DllImport("MF.dll", ExactSpelling = true)]
static extern int MFRequireProtectedEnvironment(
    IntPtr pPresentationDescriptor   // IMFPresentationDescriptor*
);
<DllImport("MF.dll", ExactSpelling:=True)>
Public Shared Function MFRequireProtectedEnvironment(
    pPresentationDescriptor As IntPtr   ' IMFPresentationDescriptor*
) As Integer
End Function
' pPresentationDescriptor : IMFPresentationDescriptor*
Declare PtrSafe Function MFRequireProtectedEnvironment Lib "mf" ( _
    ByVal pPresentationDescriptor As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

MFRequireProtectedEnvironment = ctypes.windll.mf.MFRequireProtectedEnvironment
MFRequireProtectedEnvironment.restype = ctypes.c_int
MFRequireProtectedEnvironment.argtypes = [
    ctypes.c_void_p,  # pPresentationDescriptor : IMFPresentationDescriptor*
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('MF.dll')
MFRequireProtectedEnvironment = Fiddle::Function.new(
  lib['MFRequireProtectedEnvironment'],
  [
    Fiddle::TYPE_VOIDP,  # pPresentationDescriptor : IMFPresentationDescriptor*
  ],
  Fiddle::TYPE_INT)
#[link(name = "mf")]
extern "system" {
    fn MFRequireProtectedEnvironment(
        pPresentationDescriptor: *mut core::ffi::c_void  // IMFPresentationDescriptor*
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("MF.dll")]
public static extern int MFRequireProtectedEnvironment(IntPtr pPresentationDescriptor);
"@
$api = Add-Type -MemberDefinition $sig -Name 'MF_MFRequireProtectedEnvironment' -Namespace Win32 -PassThru
# $api::MFRequireProtectedEnvironment(pPresentationDescriptor)
#uselib "MF.dll"
#func global MFRequireProtectedEnvironment "MFRequireProtectedEnvironment" sptr
; MFRequireProtectedEnvironment pPresentationDescriptor   ; 戻り値は stat
; pPresentationDescriptor : IMFPresentationDescriptor* -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "MF.dll"
#cfunc global MFRequireProtectedEnvironment "MFRequireProtectedEnvironment" sptr
; res = MFRequireProtectedEnvironment(pPresentationDescriptor)
; pPresentationDescriptor : IMFPresentationDescriptor* -> "sptr"
; HRESULT MFRequireProtectedEnvironment(IMFPresentationDescriptor* pPresentationDescriptor)
#uselib "MF.dll"
#cfunc global MFRequireProtectedEnvironment "MFRequireProtectedEnvironment" intptr
; res = MFRequireProtectedEnvironment(pPresentationDescriptor)
; pPresentationDescriptor : IMFPresentationDescriptor* -> "intptr"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	mf = windows.NewLazySystemDLL("MF.dll")
	procMFRequireProtectedEnvironment = mf.NewProc("MFRequireProtectedEnvironment")
)

// pPresentationDescriptor (IMFPresentationDescriptor*)
r1, _, err := procMFRequireProtectedEnvironment.Call(
	uintptr(pPresentationDescriptor),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // HRESULT
function MFRequireProtectedEnvironment(
  pPresentationDescriptor: Pointer   // IMFPresentationDescriptor*
): Integer; stdcall;
  external 'MF.dll' name 'MFRequireProtectedEnvironment';
result := DllCall("MF\MFRequireProtectedEnvironment"
    , "Ptr", pPresentationDescriptor   ; IMFPresentationDescriptor*
    , "Int")   ; return: HRESULT
●MFRequireProtectedEnvironment(pPresentationDescriptor) = DLL("MF.dll", "int MFRequireProtectedEnvironment(void*)")
# 呼び出し: MFRequireProtectedEnvironment(pPresentationDescriptor)
# pPresentationDescriptor : IMFPresentationDescriptor* -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。