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