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

MFCreateProxyLocator

関数
ネットワーク再生用のプロキシロケータを生成する。
DLLMF.dll呼出規約winapi対応OSWindows Vista 以降

シグネチャ

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

HRESULT MFCreateProxyLocator(
    LPCWSTR pszProtocol,
    IPropertyStore* pProxyConfig,
    IMFNetProxyLocator** ppProxyLocator
);

パラメーター

名前方向
pszProtocolLPCWSTRin
pProxyConfigIPropertyStore*in
ppProxyLocatorIMFNetProxyLocator**out

戻り値の型: HRESULT

各言語での呼び出し定義

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

HRESULT MFCreateProxyLocator(
    LPCWSTR pszProtocol,
    IPropertyStore* pProxyConfig,
    IMFNetProxyLocator** ppProxyLocator
);
[DllImport("MF.dll", ExactSpelling = true)]
static extern int MFCreateProxyLocator(
    [MarshalAs(UnmanagedType.LPWStr)] string pszProtocol,   // LPCWSTR
    IntPtr pProxyConfig,   // IPropertyStore*
    IntPtr ppProxyLocator   // IMFNetProxyLocator** out
);
<DllImport("MF.dll", ExactSpelling:=True)>
Public Shared Function MFCreateProxyLocator(
    <MarshalAs(UnmanagedType.LPWStr)> pszProtocol As String,   ' LPCWSTR
    pProxyConfig As IntPtr,   ' IPropertyStore*
    ppProxyLocator As IntPtr   ' IMFNetProxyLocator** out
) As Integer
End Function
' pszProtocol : LPCWSTR
' pProxyConfig : IPropertyStore*
' ppProxyLocator : IMFNetProxyLocator** out
Declare PtrSafe Function MFCreateProxyLocator Lib "mf" ( _
    ByVal pszProtocol As LongPtr, _
    ByVal pProxyConfig As LongPtr, _
    ByVal ppProxyLocator As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

MFCreateProxyLocator = ctypes.windll.mf.MFCreateProxyLocator
MFCreateProxyLocator.restype = ctypes.c_int
MFCreateProxyLocator.argtypes = [
    wintypes.LPCWSTR,  # pszProtocol : LPCWSTR
    ctypes.c_void_p,  # pProxyConfig : IPropertyStore*
    ctypes.c_void_p,  # ppProxyLocator : IMFNetProxyLocator** out
]
require 'fiddle'
require 'fiddle/import'

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

var (
	mf = windows.NewLazySystemDLL("MF.dll")
	procMFCreateProxyLocator = mf.NewProc("MFCreateProxyLocator")
)

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