Win32 API 日本語リファレンス
ホームUI.Shell › ILLoadFromStreamEx

ILLoadFromStreamEx

関数
ストリームからPIDLを読み込んで復元する。
DLLSHELL32.dll呼出規約winapi対応OSWindows Vista 以降

シグネチャ

// SHELL32.dll
#include <windows.h>

HRESULT ILLoadFromStreamEx(
    IStream* pstm,
    ITEMIDLIST** pidl
);

パラメーター

名前方向説明
pstmIStream*in絶対 ITEMIDLIST の読み込み元となる IStream インターフェイスへのポインターです。
pidlITEMIDLIST**outこのメソッドが成功して返ると、結果として得られる絶対 ITEMIDLIST が格納されます。失敗した場合は NULL が格納されます。

戻り値の型: HRESULT

公式ドキュメント

この関数は変更されるか、利用できなくなる可能性があります。

戻り値

型: HRESULT

この関数が成功した場合は S_OK を返します。それ以外の場合は HRESULT エラーコードを返します。

解説(Remarks)

STRICT_TYPED_ITEMIDS が定義されている場合に使用します。

出典・ライセンス: 上記「公式ドキュメント」の内容は Microsoft の Win32 API ドキュメント(MicrosoftDocs/sdk-api)を日本語に翻訳・改変したものです。© Microsoft Corporation. CC BY 4.0 で提供。
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)

各言語での呼び出し定義

// SHELL32.dll
#include <windows.h>

HRESULT ILLoadFromStreamEx(
    IStream* pstm,
    ITEMIDLIST** pidl
);
[DllImport("SHELL32.dll", ExactSpelling = true)]
static extern int ILLoadFromStreamEx(
    IntPtr pstm,   // IStream*
    IntPtr pidl   // ITEMIDLIST** out
);
<DllImport("SHELL32.dll", ExactSpelling:=True)>
Public Shared Function ILLoadFromStreamEx(
    pstm As IntPtr,   ' IStream*
    pidl As IntPtr   ' ITEMIDLIST** out
) As Integer
End Function
' pstm : IStream*
' pidl : ITEMIDLIST** out
Declare PtrSafe Function ILLoadFromStreamEx Lib "shell32" ( _
    ByVal pstm As LongPtr, _
    ByVal pidl As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

ILLoadFromStreamEx = ctypes.windll.shell32.ILLoadFromStreamEx
ILLoadFromStreamEx.restype = ctypes.c_int
ILLoadFromStreamEx.argtypes = [
    ctypes.c_void_p,  # pstm : IStream*
    ctypes.c_void_p,  # pidl : ITEMIDLIST** out
]
require 'fiddle'
require 'fiddle/import'

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

var (
	shell32 = windows.NewLazySystemDLL("SHELL32.dll")
	procILLoadFromStreamEx = shell32.NewProc("ILLoadFromStreamEx")
)

// pstm (IStream*), pidl (ITEMIDLIST** out)
r1, _, err := procILLoadFromStreamEx.Call(
	uintptr(pstm),
	uintptr(pidl),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // HRESULT
function ILLoadFromStreamEx(
  pstm: Pointer;   // IStream*
  pidl: Pointer   // ITEMIDLIST** out
): Integer; stdcall;
  external 'SHELL32.dll' name 'ILLoadFromStreamEx';
result := DllCall("SHELL32\ILLoadFromStreamEx"
    , "Ptr", pstm   ; IStream*
    , "Ptr", pidl   ; ITEMIDLIST** out
    , "Int")   ; return: HRESULT
●ILLoadFromStreamEx(pstm, pidl) = DLL("SHELL32.dll", "int ILLoadFromStreamEx(void*, void*)")
# 呼び出し: ILLoadFromStreamEx(pstm, pidl)
# pstm : IStream* -> "void*"
# pidl : ITEMIDLIST** out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
const std = @import("std");

extern "shell32" fn ILLoadFromStreamEx(
    pstm: ?*anyopaque, // IStream*
    pidl: [*c][*c]ITEMIDLIST // ITEMIDLIST** out
) callconv(std.os.windows.WINAPI) i32;
proc ILLoadFromStreamEx(
    pstm: pointer,  # IStream*
    pidl: ptr ITEMIDLIST  # ITEMIDLIST** out
): int32 {.importc: "ILLoadFromStreamEx", stdcall, dynlib: "SHELL32.dll".}
pragma(lib, "shell32");
extern(Windows)
int ILLoadFromStreamEx(
    void* pstm,   // IStream*
    ITEMIDLIST** pidl   // ITEMIDLIST** out
);
ccall((:ILLoadFromStreamEx, "SHELL32.dll"), stdcall, Int32,
      (Ptr{Cvoid}, Ptr{ITEMIDLIST}),
      pstm, pidl)
# pstm : IStream* -> Ptr{Cvoid}
# pidl : ITEMIDLIST** out -> Ptr{ITEMIDLIST}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。
local ffi = require("ffi")
ffi.cdef[[
int32_t ILLoadFromStreamEx(
    void* pstm,
    void* pidl);
]]
local shell32 = ffi.load("shell32")
-- shell32.ILLoadFromStreamEx(pstm, pidl)
-- pstm : IStream*
-- pidl : ITEMIDLIST** out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
const koffi = require('koffi');
const lib = koffi.load('SHELL32.dll');
const ILLoadFromStreamEx = lib.func('__stdcall', 'ILLoadFromStreamEx', 'int32_t', ['void *', 'void *']);
// ILLoadFromStreamEx(pstm, pidl)
// pstm : IStream* -> 'void *'
// pidl : ITEMIDLIST** out -> 'void *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
const lib = Deno.dlopen("SHELL32.dll", {
  ILLoadFromStreamEx: { parameters: ["pointer", "pointer"], result: "i32" },
});
// lib.symbols.ILLoadFromStreamEx(pstm, pidl)
// pstm : IStream* -> "pointer"
// pidl : ITEMIDLIST** out -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。
<?php
$ffi = FFI::cdef(<<<C
int32_t ILLoadFromStreamEx(
    void* pstm,
    void* pidl);
C, "SHELL32.dll");
// $ffi->ILLoadFromStreamEx(pstm, pidl);
// pstm : IStream*
// pidl : ITEMIDLIST** out
// 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
// WINAPI(stdcall): x64 では呼出規約が統一されるため問題なし。x86 では __stdcall 対応のラッパが必要な場合あり。
import com.sun.jna.*;
import com.sun.jna.ptr.*;
import com.sun.jna.win32.StdCallLibrary;
import com.sun.jna.win32.W32APIOptions;

public interface Shell32 extends StdCallLibrary {
    Shell32 INSTANCE = Native.load("shell32", Shell32.class);
    int ILLoadFromStreamEx(
        Pointer pstm,   // IStream*
        Pointer pidl   // ITEMIDLIST** out
    );
}
@[Link("shell32")]
lib LibSHELL32
  fun ILLoadFromStreamEx = ILLoadFromStreamEx(
    pstm : Void*,   # IStream*
    pidl : ITEMIDLIST**   # ITEMIDLIST** out
  ) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。
import 'dart:ffi';
import 'package:ffi/ffi.dart';

typedef ILLoadFromStreamExNative = Int32 Function(Pointer<Void>, Pointer<Void>);
typedef ILLoadFromStreamExDart = int Function(Pointer<Void>, Pointer<Void>);
final ILLoadFromStreamEx = DynamicLibrary.open('SHELL32.dll')
    .lookupFunction<ILLoadFromStreamExNative, ILLoadFromStreamExDart>('ILLoadFromStreamEx');
// pstm : IStream* -> Pointer<Void>
// pidl : ITEMIDLIST** out -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
function ILLoadFromStreamEx(
  pstm: Pointer;   // IStream*
  pidl: Pointer   // ITEMIDLIST** out
): Integer; stdcall;
  external 'SHELL32.dll' name 'ILLoadFromStreamEx';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import stdcall safe "ILLoadFromStreamEx"
  c_ILLoadFromStreamEx :: Ptr () -> Ptr () -> IO Int32
-- pstm : IStream* -> Ptr ()
-- pidl : ITEMIDLIST** out -> Ptr ()
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let illoadfromstreamex =
  foreign "ILLoadFromStreamEx"
    ((ptr void) @-> (ptr void) @-> returning int32_t)
(* pstm : IStream* -> (ptr void) *)
(* pidl : ITEMIDLIST** out -> (ptr void) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)
(cffi:define-foreign-library shell32 (t "SHELL32.dll"))
(cffi:use-foreign-library shell32)

(cffi:defcfun ("ILLoadFromStreamEx" ilload-from-stream-ex :convention :stdcall) :int32
  (pstm :pointer)   ; IStream*
  (pidl :pointer))   ; ITEMIDLIST** out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $ILLoadFromStreamEx = Win32::API::More->new('SHELL32',
    'int ILLoadFromStreamEx(LPVOID pstm, LPVOID pidl)');
# my $ret = $ILLoadFromStreamEx->Call($pstm, $pidl);
# pstm : IStream* -> LPVOID
# pidl : ITEMIDLIST** out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。

関連項目

使用する型