ホーム › System.ClrHosting › CorBindToRuntimeByCfg
CorBindToRuntimeByCfg
関数構成ファイルストリームに基づいてCLRランタイムにバインドする。
シグネチャ
// MSCorEE.dll
#include <windows.h>
HRESULT CorBindToRuntimeByCfg(
IStream* pCfgStream,
DWORD reserved,
DWORD startupFlags,
const GUID* rclsid,
const GUID* riid,
void** ppv
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| pCfgStream | IStream* | in |
| reserved | DWORD | in |
| startupFlags | DWORD | in |
| rclsid | GUID* | in |
| riid | GUID* | in |
| ppv | void** | inout |
戻り値の型: HRESULT
各言語での呼び出し定義
// MSCorEE.dll
#include <windows.h>
HRESULT CorBindToRuntimeByCfg(
IStream* pCfgStream,
DWORD reserved,
DWORD startupFlags,
const GUID* rclsid,
const GUID* riid,
void** ppv
);[DllImport("MSCorEE.dll", ExactSpelling = true)]
static extern int CorBindToRuntimeByCfg(
IntPtr pCfgStream, // IStream*
uint reserved, // DWORD
uint startupFlags, // DWORD
ref Guid rclsid, // GUID*
ref Guid riid, // GUID*
IntPtr ppv // void** in/out
);<DllImport("MSCorEE.dll", ExactSpelling:=True)>
Public Shared Function CorBindToRuntimeByCfg(
pCfgStream As IntPtr, ' IStream*
reserved As UInteger, ' DWORD
startupFlags As UInteger, ' DWORD
ByRef rclsid As Guid, ' GUID*
ByRef riid As Guid, ' GUID*
ppv As IntPtr ' void** in/out
) As Integer
End Function' pCfgStream : IStream*
' reserved : DWORD
' startupFlags : DWORD
' rclsid : GUID*
' riid : GUID*
' ppv : void** in/out
Declare PtrSafe Function CorBindToRuntimeByCfg Lib "mscoree" ( _
ByVal pCfgStream As LongPtr, _
ByVal reserved As Long, _
ByVal startupFlags As Long, _
ByVal rclsid As LongPtr, _
ByVal riid As LongPtr, _
ByVal ppv As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
CorBindToRuntimeByCfg = ctypes.windll.mscoree.CorBindToRuntimeByCfg
CorBindToRuntimeByCfg.restype = ctypes.c_int
CorBindToRuntimeByCfg.argtypes = [
ctypes.c_void_p, # pCfgStream : IStream*
wintypes.DWORD, # reserved : DWORD
wintypes.DWORD, # startupFlags : DWORD
ctypes.c_void_p, # rclsid : GUID*
ctypes.c_void_p, # riid : GUID*
ctypes.c_void_p, # ppv : void** in/out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('MSCorEE.dll')
CorBindToRuntimeByCfg = Fiddle::Function.new(
lib['CorBindToRuntimeByCfg'],
[
Fiddle::TYPE_VOIDP, # pCfgStream : IStream*
-Fiddle::TYPE_INT, # reserved : DWORD
-Fiddle::TYPE_INT, # startupFlags : DWORD
Fiddle::TYPE_VOIDP, # rclsid : GUID*
Fiddle::TYPE_VOIDP, # riid : GUID*
Fiddle::TYPE_VOIDP, # ppv : void** in/out
],
Fiddle::TYPE_INT)#[link(name = "mscoree")]
extern "system" {
fn CorBindToRuntimeByCfg(
pCfgStream: *mut core::ffi::c_void, // IStream*
reserved: u32, // DWORD
startupFlags: u32, // DWORD
rclsid: *const GUID, // GUID*
riid: *const GUID, // GUID*
ppv: *mut *mut () // void** in/out
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("MSCorEE.dll")]
public static extern int CorBindToRuntimeByCfg(IntPtr pCfgStream, uint reserved, uint startupFlags, ref Guid rclsid, ref Guid riid, IntPtr ppv);
"@
$api = Add-Type -MemberDefinition $sig -Name 'MSCorEE_CorBindToRuntimeByCfg' -Namespace Win32 -PassThru
# $api::CorBindToRuntimeByCfg(pCfgStream, reserved, startupFlags, rclsid, riid, ppv)#uselib "MSCorEE.dll"
#func global CorBindToRuntimeByCfg "CorBindToRuntimeByCfg" sptr, sptr, sptr, sptr, sptr, sptr
; CorBindToRuntimeByCfg pCfgStream, reserved, startupFlags, varptr(rclsid), varptr(riid), ppv ; 戻り値は stat
; pCfgStream : IStream* -> "sptr"
; reserved : DWORD -> "sptr"
; startupFlags : DWORD -> "sptr"
; rclsid : GUID* -> "sptr"
; riid : GUID* -> "sptr"
; ppv : void** in/out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "MSCorEE.dll" #cfunc global CorBindToRuntimeByCfg "CorBindToRuntimeByCfg" sptr, int, int, var, var, sptr ; res = CorBindToRuntimeByCfg(pCfgStream, reserved, startupFlags, rclsid, riid, ppv) ; pCfgStream : IStream* -> "sptr" ; reserved : DWORD -> "int" ; startupFlags : DWORD -> "int" ; rclsid : GUID* -> "var" ; riid : GUID* -> "var" ; ppv : void** in/out -> "sptr" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "MSCorEE.dll" #cfunc global CorBindToRuntimeByCfg "CorBindToRuntimeByCfg" sptr, int, int, sptr, sptr, sptr ; res = CorBindToRuntimeByCfg(pCfgStream, reserved, startupFlags, varptr(rclsid), varptr(riid), ppv) ; pCfgStream : IStream* -> "sptr" ; reserved : DWORD -> "int" ; startupFlags : DWORD -> "int" ; rclsid : GUID* -> "sptr" ; riid : GUID* -> "sptr" ; ppv : void** in/out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; HRESULT CorBindToRuntimeByCfg(IStream* pCfgStream, DWORD reserved, DWORD startupFlags, GUID* rclsid, GUID* riid, void** ppv) #uselib "MSCorEE.dll" #cfunc global CorBindToRuntimeByCfg "CorBindToRuntimeByCfg" intptr, int, int, var, var, intptr ; res = CorBindToRuntimeByCfg(pCfgStream, reserved, startupFlags, rclsid, riid, ppv) ; pCfgStream : IStream* -> "intptr" ; reserved : DWORD -> "int" ; startupFlags : DWORD -> "int" ; rclsid : GUID* -> "var" ; riid : GUID* -> "var" ; ppv : void** in/out -> "intptr" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; HRESULT CorBindToRuntimeByCfg(IStream* pCfgStream, DWORD reserved, DWORD startupFlags, GUID* rclsid, GUID* riid, void** ppv) #uselib "MSCorEE.dll" #cfunc global CorBindToRuntimeByCfg "CorBindToRuntimeByCfg" intptr, int, int, intptr, intptr, intptr ; res = CorBindToRuntimeByCfg(pCfgStream, reserved, startupFlags, varptr(rclsid), varptr(riid), ppv) ; pCfgStream : IStream* -> "intptr" ; reserved : DWORD -> "int" ; startupFlags : DWORD -> "int" ; rclsid : GUID* -> "intptr" ; riid : GUID* -> "intptr" ; ppv : void** in/out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
mscoree = windows.NewLazySystemDLL("MSCorEE.dll")
procCorBindToRuntimeByCfg = mscoree.NewProc("CorBindToRuntimeByCfg")
)
// pCfgStream (IStream*), reserved (DWORD), startupFlags (DWORD), rclsid (GUID*), riid (GUID*), ppv (void** in/out)
r1, _, err := procCorBindToRuntimeByCfg.Call(
uintptr(pCfgStream),
uintptr(reserved),
uintptr(startupFlags),
uintptr(rclsid),
uintptr(riid),
uintptr(ppv),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HRESULTfunction CorBindToRuntimeByCfg(
pCfgStream: Pointer; // IStream*
reserved: DWORD; // DWORD
startupFlags: DWORD; // DWORD
rclsid: PGUID; // GUID*
riid: PGUID; // GUID*
ppv: Pointer // void** in/out
): Integer; stdcall;
external 'MSCorEE.dll' name 'CorBindToRuntimeByCfg';result := DllCall("MSCorEE\CorBindToRuntimeByCfg"
, "Ptr", pCfgStream ; IStream*
, "UInt", reserved ; DWORD
, "UInt", startupFlags ; DWORD
, "Ptr", rclsid ; GUID*
, "Ptr", riid ; GUID*
, "Ptr", ppv ; void** in/out
, "Int") ; return: HRESULT●CorBindToRuntimeByCfg(pCfgStream, reserved, startupFlags, rclsid, riid, ppv) = DLL("MSCorEE.dll", "int CorBindToRuntimeByCfg(void*, dword, dword, void*, void*, void*)")
# 呼び出し: CorBindToRuntimeByCfg(pCfgStream, reserved, startupFlags, rclsid, riid, ppv)
# pCfgStream : IStream* -> "void*"
# reserved : DWORD -> "dword"
# startupFlags : DWORD -> "dword"
# rclsid : GUID* -> "void*"
# riid : GUID* -> "void*"
# ppv : void** in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。