IStream_Copy
関数あるストリームから別のストリームへ指定量を複写する。
シグネチャ
// SHLWAPI.dll
#include <windows.h>
HRESULT IStream_Copy(
IStream* pstmFrom,
IStream* pstmTo,
DWORD cb
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| pstmFrom | IStream* | in |
| pstmTo | IStream* | in |
| cb | DWORD | in |
戻り値の型: HRESULT
各言語での呼び出し定義
// SHLWAPI.dll
#include <windows.h>
HRESULT IStream_Copy(
IStream* pstmFrom,
IStream* pstmTo,
DWORD cb
);[DllImport("SHLWAPI.dll", ExactSpelling = true)]
static extern int IStream_Copy(
IntPtr pstmFrom, // IStream*
IntPtr pstmTo, // IStream*
uint cb // DWORD
);<DllImport("SHLWAPI.dll", ExactSpelling:=True)>
Public Shared Function IStream_Copy(
pstmFrom As IntPtr, ' IStream*
pstmTo As IntPtr, ' IStream*
cb As UInteger ' DWORD
) As Integer
End Function' pstmFrom : IStream*
' pstmTo : IStream*
' cb : DWORD
Declare PtrSafe Function IStream_Copy Lib "shlwapi" ( _
ByVal pstmFrom As LongPtr, _
ByVal pstmTo As LongPtr, _
ByVal cb As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
IStream_Copy = ctypes.windll.shlwapi.IStream_Copy
IStream_Copy.restype = ctypes.c_int
IStream_Copy.argtypes = [
ctypes.c_void_p, # pstmFrom : IStream*
ctypes.c_void_p, # pstmTo : IStream*
wintypes.DWORD, # cb : DWORD
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('SHLWAPI.dll')
IStream_Copy = Fiddle::Function.new(
lib['IStream_Copy'],
[
Fiddle::TYPE_VOIDP, # pstmFrom : IStream*
Fiddle::TYPE_VOIDP, # pstmTo : IStream*
-Fiddle::TYPE_INT, # cb : DWORD
],
Fiddle::TYPE_INT)#[link(name = "shlwapi")]
extern "system" {
fn IStream_Copy(
pstmFrom: *mut core::ffi::c_void, // IStream*
pstmTo: *mut core::ffi::c_void, // IStream*
cb: u32 // DWORD
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("SHLWAPI.dll")]
public static extern int IStream_Copy(IntPtr pstmFrom, IntPtr pstmTo, uint cb);
"@
$api = Add-Type -MemberDefinition $sig -Name 'SHLWAPI_IStream_Copy' -Namespace Win32 -PassThru
# $api::IStream_Copy(pstmFrom, pstmTo, cb)#uselib "SHLWAPI.dll"
#func global IStream_Copy "IStream_Copy" sptr, sptr, sptr
; IStream_Copy pstmFrom, pstmTo, cb ; 戻り値は stat
; pstmFrom : IStream* -> "sptr"
; pstmTo : IStream* -> "sptr"
; cb : DWORD -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "SHLWAPI.dll"
#cfunc global IStream_Copy "IStream_Copy" sptr, sptr, int
; res = IStream_Copy(pstmFrom, pstmTo, cb)
; pstmFrom : IStream* -> "sptr"
; pstmTo : IStream* -> "sptr"
; cb : DWORD -> "int"; HRESULT IStream_Copy(IStream* pstmFrom, IStream* pstmTo, DWORD cb)
#uselib "SHLWAPI.dll"
#cfunc global IStream_Copy "IStream_Copy" intptr, intptr, int
; res = IStream_Copy(pstmFrom, pstmTo, cb)
; pstmFrom : IStream* -> "intptr"
; pstmTo : IStream* -> "intptr"
; cb : DWORD -> "int"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
shlwapi = windows.NewLazySystemDLL("SHLWAPI.dll")
procIStream_Copy = shlwapi.NewProc("IStream_Copy")
)
// pstmFrom (IStream*), pstmTo (IStream*), cb (DWORD)
r1, _, err := procIStream_Copy.Call(
uintptr(pstmFrom),
uintptr(pstmTo),
uintptr(cb),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HRESULTfunction IStream_Copy(
pstmFrom: Pointer; // IStream*
pstmTo: Pointer; // IStream*
cb: DWORD // DWORD
): Integer; stdcall;
external 'SHLWAPI.dll' name 'IStream_Copy';result := DllCall("SHLWAPI\IStream_Copy"
, "Ptr", pstmFrom ; IStream*
, "Ptr", pstmTo ; IStream*
, "UInt", cb ; DWORD
, "Int") ; return: HRESULT●IStream_Copy(pstmFrom, pstmTo, cb) = DLL("SHLWAPI.dll", "int IStream_Copy(void*, void*, dword)")
# 呼び出し: IStream_Copy(pstmFrom, pstmTo, cb)
# pstmFrom : IStream* -> "void*"
# pstmTo : IStream* -> "void*"
# cb : DWORD -> "dword"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。