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