Win32 API 日本語リファレンス
ホームSystem.WinRT › CreateRandomAccessStreamOverStream

CreateRandomAccessStreamOverStream

関数
IStream上にWinRTランダムアクセスストリームを作成する。
DLLapi-ms-win-shcore-stream-winrt-l1-1-0.dll呼出規約winapi対応OSwindows8.0

シグネチャ

// api-ms-win-shcore-stream-winrt-l1-1-0.dll
#include <windows.h>

HRESULT CreateRandomAccessStreamOverStream(
    IStream* stream,
    BSOS_OPTIONS options,
    const GUID* riid,
    void** ppv
);

パラメーター

名前方向
streamIStream*in
optionsBSOS_OPTIONSin
riidGUID*in
ppvvoid**out

戻り値の型: HRESULT

各言語での呼び出し定義

// api-ms-win-shcore-stream-winrt-l1-1-0.dll
#include <windows.h>

HRESULT CreateRandomAccessStreamOverStream(
    IStream* stream,
    BSOS_OPTIONS options,
    const GUID* riid,
    void** ppv
);
[DllImport("api-ms-win-shcore-stream-winrt-l1-1-0.dll", ExactSpelling = true)]
static extern int CreateRandomAccessStreamOverStream(
    IntPtr stream,   // IStream*
    int options,   // BSOS_OPTIONS
    ref Guid riid,   // GUID*
    IntPtr ppv   // void** out
);
<DllImport("api-ms-win-shcore-stream-winrt-l1-1-0.dll", ExactSpelling:=True)>
Public Shared Function CreateRandomAccessStreamOverStream(
    stream As IntPtr,   ' IStream*
    options As Integer,   ' BSOS_OPTIONS
    ByRef riid As Guid,   ' GUID*
    ppv As IntPtr   ' void** out
) As Integer
End Function
' stream : IStream*
' options : BSOS_OPTIONS
' riid : GUID*
' ppv : void** out
Declare PtrSafe Function CreateRandomAccessStreamOverStream Lib "api-ms-win-shcore-stream-winrt-l1-1-0" ( _
    ByVal stream As LongPtr, _
    ByVal options As Long, _
    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

CreateRandomAccessStreamOverStream = ctypes.windll.LoadLibrary("api-ms-win-shcore-stream-winrt-l1-1-0.dll").CreateRandomAccessStreamOverStream
CreateRandomAccessStreamOverStream.restype = ctypes.c_int
CreateRandomAccessStreamOverStream.argtypes = [
    ctypes.c_void_p,  # stream : IStream*
    ctypes.c_int,  # options : BSOS_OPTIONS
    ctypes.c_void_p,  # riid : GUID*
    ctypes.c_void_p,  # ppv : void** out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('api-ms-win-shcore-stream-winrt-l1-1-0.dll')
CreateRandomAccessStreamOverStream = Fiddle::Function.new(
  lib['CreateRandomAccessStreamOverStream'],
  [
    Fiddle::TYPE_VOIDP,  # stream : IStream*
    Fiddle::TYPE_INT,  # options : BSOS_OPTIONS
    Fiddle::TYPE_VOIDP,  # riid : GUID*
    Fiddle::TYPE_VOIDP,  # ppv : void** out
  ],
  Fiddle::TYPE_INT)
#[link(name = "api-ms-win-shcore-stream-winrt-l1-1-0")]
extern "system" {
    fn CreateRandomAccessStreamOverStream(
        stream: *mut core::ffi::c_void,  // IStream*
        options: i32,  // BSOS_OPTIONS
        riid: *const GUID,  // GUID*
        ppv: *mut *mut ()  // void** out
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("api-ms-win-shcore-stream-winrt-l1-1-0.dll")]
public static extern int CreateRandomAccessStreamOverStream(IntPtr stream, int options, ref Guid riid, IntPtr ppv);
"@
$api = Add-Type -MemberDefinition $sig -Name 'api-ms-win-shcore-stream-winrt-l1-1-0_CreateRandomAccessStreamOverStream' -Namespace Win32 -PassThru
# $api::CreateRandomAccessStreamOverStream(stream, options, riid, ppv)
#uselib "api-ms-win-shcore-stream-winrt-l1-1-0.dll"
#func global CreateRandomAccessStreamOverStream "CreateRandomAccessStreamOverStream" sptr, sptr, sptr, sptr
; CreateRandomAccessStreamOverStream stream, options, varptr(riid), ppv   ; 戻り値は stat
; stream : IStream* -> "sptr"
; options : BSOS_OPTIONS -> "sptr"
; riid : GUID* -> "sptr"
; ppv : void** out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "api-ms-win-shcore-stream-winrt-l1-1-0.dll"
#cfunc global CreateRandomAccessStreamOverStream "CreateRandomAccessStreamOverStream" sptr, int, var, sptr
; res = CreateRandomAccessStreamOverStream(stream, options, riid, ppv)
; stream : IStream* -> "sptr"
; options : BSOS_OPTIONS -> "int"
; riid : GUID* -> "var"
; ppv : void** out -> "sptr"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; HRESULT CreateRandomAccessStreamOverStream(IStream* stream, BSOS_OPTIONS options, GUID* riid, void** ppv)
#uselib "api-ms-win-shcore-stream-winrt-l1-1-0.dll"
#cfunc global CreateRandomAccessStreamOverStream "CreateRandomAccessStreamOverStream" intptr, int, var, intptr
; res = CreateRandomAccessStreamOverStream(stream, options, riid, ppv)
; stream : IStream* -> "intptr"
; options : BSOS_OPTIONS -> "int"
; riid : GUID* -> "var"
; ppv : void** out -> "intptr"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	api_ms_win_shcore_stream_winrt_l1_1_0 = windows.NewLazySystemDLL("api-ms-win-shcore-stream-winrt-l1-1-0.dll")
	procCreateRandomAccessStreamOverStream = api_ms_win_shcore_stream_winrt_l1_1_0.NewProc("CreateRandomAccessStreamOverStream")
)

// stream (IStream*), options (BSOS_OPTIONS), riid (GUID*), ppv (void** out)
r1, _, err := procCreateRandomAccessStreamOverStream.Call(
	uintptr(stream),
	uintptr(options),
	uintptr(riid),
	uintptr(ppv),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // HRESULT
function CreateRandomAccessStreamOverStream(
  stream: Pointer;   // IStream*
  options: Integer;   // BSOS_OPTIONS
  riid: PGUID;   // GUID*
  ppv: Pointer   // void** out
): Integer; stdcall;
  external 'api-ms-win-shcore-stream-winrt-l1-1-0.dll' name 'CreateRandomAccessStreamOverStream';
result := DllCall("api-ms-win-shcore-stream-winrt-l1-1-0\CreateRandomAccessStreamOverStream"
    , "Ptr", stream   ; IStream*
    , "Int", options   ; BSOS_OPTIONS
    , "Ptr", riid   ; GUID*
    , "Ptr", ppv   ; void** out
    , "Int")   ; return: HRESULT
●CreateRandomAccessStreamOverStream(stream, options, riid, ppv) = DLL("api-ms-win-shcore-stream-winrt-l1-1-0.dll", "int CreateRandomAccessStreamOverStream(void*, int, void*, void*)")
# 呼び出し: CreateRandomAccessStreamOverStream(stream, options, riid, ppv)
# stream : IStream* -> "void*"
# options : BSOS_OPTIONS -> "int"
# riid : GUID* -> "void*"
# ppv : void** out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。