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

プロトコルの名前。

Note このリリースの Media Foundation では、既定のプロキシロケーターは RTSP をサポートしません。
pProxyConfigIPropertyStore*inMFNETSOURCE_PROXYSETTINGS プロパティにプロキシ構成を格納するプロパティストアの IPropertyStore インターフェイスへのポインター。
ppProxyLocatorIMFNetProxyLocator**outIMFNetProxyLocator インターフェイスへのポインターを受け取ります。呼び出し元はこのインターフェイスを解放する必要があります。

戻り値の型: HRESULT

公式ドキュメント

既定のプロキシロケーターを作成します。

戻り値

この関数は HRESULT を返します。指定できる値には次の表の値が含まれますが、これらに限定されません。

戻り値 説明
S_OK
関数が成功しました。
出典・ライセンス: 上記「公式ドキュメント」の内容は Microsoft の Win32 API ドキュメント(MicrosoftDocs/sdk-api)を日本語に翻訳・改変したものです。© Microsoft Corporation. CC BY 4.0 で提供。
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)

各言語での呼び出し定義

// 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)。
const std = @import("std");

extern "mf" fn MFCreateProxyLocator(
    pszProtocol: [*c]const u16, // LPCWSTR
    pProxyConfig: ?*anyopaque, // IPropertyStore*
    ppProxyLocator: ?*anyopaque // IMFNetProxyLocator** out
) callconv(std.os.windows.WINAPI) i32;
proc MFCreateProxyLocator(
    pszProtocol: WideCString,  # LPCWSTR
    pProxyConfig: pointer,  # IPropertyStore*
    ppProxyLocator: pointer  # IMFNetProxyLocator** out
): int32 {.importc: "MFCreateProxyLocator", stdcall, dynlib: "MF.dll".}
pragma(lib, "mf");
extern(Windows)
int MFCreateProxyLocator(
    const(wchar)* pszProtocol,   // LPCWSTR
    void* pProxyConfig,   // IPropertyStore*
    void* ppProxyLocator   // IMFNetProxyLocator** out
);
ccall((:MFCreateProxyLocator, "MF.dll"), stdcall, Int32,
      (Cwstring, Ptr{Cvoid}, Ptr{Cvoid}),
      pszProtocol, pProxyConfig, ppProxyLocator)
# pszProtocol : LPCWSTR -> Cwstring
# pProxyConfig : IPropertyStore* -> Ptr{Cvoid}
# ppProxyLocator : IMFNetProxyLocator** out -> Ptr{Cvoid}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。
local ffi = require("ffi")
ffi.cdef[[
int32_t MFCreateProxyLocator(
    const uint16_t* pszProtocol,
    void* pProxyConfig,
    void* ppProxyLocator);
]]
local mf = ffi.load("mf")
-- mf.MFCreateProxyLocator(pszProtocol, pProxyConfig, ppProxyLocator)
-- pszProtocol : LPCWSTR
-- pProxyConfig : IPropertyStore*
-- ppProxyLocator : IMFNetProxyLocator** out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
const koffi = require('koffi');
const lib = koffi.load('MF.dll');
const MFCreateProxyLocator = lib.func('__stdcall', 'MFCreateProxyLocator', 'int32_t', ['str16', 'void *', 'void *']);
// MFCreateProxyLocator(pszProtocol, pProxyConfig, ppProxyLocator)
// pszProtocol : LPCWSTR -> 'str16'
// pProxyConfig : IPropertyStore* -> 'void *'
// ppProxyLocator : IMFNetProxyLocator** out -> 'void *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
const lib = Deno.dlopen("MF.dll", {
  MFCreateProxyLocator: { parameters: ["buffer", "pointer", "pointer"], result: "i32" },
});
// lib.symbols.MFCreateProxyLocator(pszProtocol, pProxyConfig, ppProxyLocator)
// pszProtocol : LPCWSTR -> "buffer"
// pProxyConfig : IPropertyStore* -> "pointer"
// ppProxyLocator : IMFNetProxyLocator** out -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。
<?php
$ffi = FFI::cdef(<<<C
int32_t MFCreateProxyLocator(
    const uint16_t* pszProtocol,
    void* pProxyConfig,
    void* ppProxyLocator);
C, "MF.dll");
// $ffi->MFCreateProxyLocator(pszProtocol, pProxyConfig, ppProxyLocator);
// pszProtocol : LPCWSTR
// pProxyConfig : IPropertyStore*
// ppProxyLocator : IMFNetProxyLocator** 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 Mf extends StdCallLibrary {
    Mf INSTANCE = Native.load("mf", Mf.class);
    int MFCreateProxyLocator(
        WString pszProtocol,   // LPCWSTR
        Pointer pProxyConfig,   // IPropertyStore*
        Pointer ppProxyLocator   // IMFNetProxyLocator** out
    );
}
@[Link("mf")]
lib LibMF
  fun MFCreateProxyLocator = MFCreateProxyLocator(
    pszProtocol : UInt16*,   # LPCWSTR
    pProxyConfig : Void*,   # IPropertyStore*
    ppProxyLocator : Void*   # IMFNetProxyLocator** out
  ) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。
import 'dart:ffi';
import 'package:ffi/ffi.dart';

typedef MFCreateProxyLocatorNative = Int32 Function(Pointer<Utf16>, Pointer<Void>, Pointer<Void>);
typedef MFCreateProxyLocatorDart = int Function(Pointer<Utf16>, Pointer<Void>, Pointer<Void>);
final MFCreateProxyLocator = DynamicLibrary.open('MF.dll')
    .lookupFunction<MFCreateProxyLocatorNative, MFCreateProxyLocatorDart>('MFCreateProxyLocator');
// pszProtocol : LPCWSTR -> Pointer<Utf16>
// pProxyConfig : IPropertyStore* -> Pointer<Void>
// ppProxyLocator : IMFNetProxyLocator** out -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
function MFCreateProxyLocator(
  pszProtocol: PWideChar;   // LPCWSTR
  pProxyConfig: Pointer;   // IPropertyStore*
  ppProxyLocator: Pointer   // IMFNetProxyLocator** out
): Integer; stdcall;
  external 'MF.dll' name 'MFCreateProxyLocator';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import stdcall safe "MFCreateProxyLocator"
  c_MFCreateProxyLocator :: CWString -> Ptr () -> Ptr () -> IO Int32
-- pszProtocol : LPCWSTR -> CWString
-- pProxyConfig : IPropertyStore* -> Ptr ()
-- ppProxyLocator : IMFNetProxyLocator** out -> Ptr ()
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let mfcreateproxylocator =
  foreign "MFCreateProxyLocator"
    ((ptr uint16_t) @-> (ptr void) @-> (ptr void) @-> returning int32_t)
(* pszProtocol : LPCWSTR -> (ptr uint16_t) *)
(* pProxyConfig : IPropertyStore* -> (ptr void) *)
(* ppProxyLocator : IMFNetProxyLocator** out -> (ptr void) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)
(cffi:define-foreign-library mf (t "MF.dll"))
(cffi:use-foreign-library mf)

(cffi:defcfun ("MFCreateProxyLocator" mfcreate-proxy-locator :convention :stdcall) :int32
  (psz-protocol (:string :encoding :utf-16le))   ; LPCWSTR
  (p-proxy-config :pointer)   ; IPropertyStore*
  (pp-proxy-locator :pointer))   ; IMFNetProxyLocator** out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $MFCreateProxyLocator = Win32::API::More->new('MF',
    'int MFCreateProxyLocator(LPCWSTR pszProtocol, LPVOID pProxyConfig, LPVOID ppProxyLocator)');
# my $ret = $MFCreateProxyLocator->Call($pszProtocol, $pProxyConfig, $ppProxyLocator);
# pszProtocol : LPCWSTR -> LPCWSTR
# pProxyConfig : IPropertyStore* -> LPVOID
# ppProxyLocator : IMFNetProxyLocator** out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。

関連項目

使用する型