ホーム › System.Com.StructuredStorage › StgCreatePropSetStg
StgCreatePropSetStg
関数ストレージ上にプロパティセットストレージを作成する。
シグネチャ
// OLE32.dll
#include <windows.h>
HRESULT StgCreatePropSetStg(
IStorage* pStorage,
DWORD dwReserved, // optional
IPropertySetStorage** ppPropSetStg
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| pStorage | IStorage* | in | プロパティセット群を格納するIStorageへのポインタ。 |
| dwReserved | DWORD | optional | 予約パラメータ。0を指定する。 |
| ppPropSetStg | IPropertySetStorage** | out | 生成したIPropertySetStorageを受け取る出力ポインタ。 |
戻り値の型: HRESULT
各言語での呼び出し定義
// OLE32.dll
#include <windows.h>
HRESULT StgCreatePropSetStg(
IStorage* pStorage,
DWORD dwReserved, // optional
IPropertySetStorage** ppPropSetStg
);[DllImport("OLE32.dll", ExactSpelling = true)]
static extern int StgCreatePropSetStg(
IntPtr pStorage, // IStorage*
uint dwReserved, // DWORD optional
IntPtr ppPropSetStg // IPropertySetStorage** out
);<DllImport("OLE32.dll", ExactSpelling:=True)>
Public Shared Function StgCreatePropSetStg(
pStorage As IntPtr, ' IStorage*
dwReserved As UInteger, ' DWORD optional
ppPropSetStg As IntPtr ' IPropertySetStorage** out
) As Integer
End Function' pStorage : IStorage*
' dwReserved : DWORD optional
' ppPropSetStg : IPropertySetStorage** out
Declare PtrSafe Function StgCreatePropSetStg Lib "ole32" ( _
ByVal pStorage As LongPtr, _
ByVal dwReserved As Long, _
ByVal ppPropSetStg As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
StgCreatePropSetStg = ctypes.windll.ole32.StgCreatePropSetStg
StgCreatePropSetStg.restype = ctypes.c_int
StgCreatePropSetStg.argtypes = [
ctypes.c_void_p, # pStorage : IStorage*
wintypes.DWORD, # dwReserved : DWORD optional
ctypes.c_void_p, # ppPropSetStg : IPropertySetStorage** out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('OLE32.dll')
StgCreatePropSetStg = Fiddle::Function.new(
lib['StgCreatePropSetStg'],
[
Fiddle::TYPE_VOIDP, # pStorage : IStorage*
-Fiddle::TYPE_INT, # dwReserved : DWORD optional
Fiddle::TYPE_VOIDP, # ppPropSetStg : IPropertySetStorage** out
],
Fiddle::TYPE_INT)#[link(name = "ole32")]
extern "system" {
fn StgCreatePropSetStg(
pStorage: *mut core::ffi::c_void, // IStorage*
dwReserved: u32, // DWORD optional
ppPropSetStg: *mut *mut core::ffi::c_void // IPropertySetStorage** out
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("OLE32.dll")]
public static extern int StgCreatePropSetStg(IntPtr pStorage, uint dwReserved, IntPtr ppPropSetStg);
"@
$api = Add-Type -MemberDefinition $sig -Name 'OLE32_StgCreatePropSetStg' -Namespace Win32 -PassThru
# $api::StgCreatePropSetStg(pStorage, dwReserved, ppPropSetStg)#uselib "OLE32.dll"
#func global StgCreatePropSetStg "StgCreatePropSetStg" sptr, sptr, sptr
; StgCreatePropSetStg pStorage, dwReserved, ppPropSetStg ; 戻り値は stat
; pStorage : IStorage* -> "sptr"
; dwReserved : DWORD optional -> "sptr"
; ppPropSetStg : IPropertySetStorage** out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "OLE32.dll"
#cfunc global StgCreatePropSetStg "StgCreatePropSetStg" sptr, int, sptr
; res = StgCreatePropSetStg(pStorage, dwReserved, ppPropSetStg)
; pStorage : IStorage* -> "sptr"
; dwReserved : DWORD optional -> "int"
; ppPropSetStg : IPropertySetStorage** out -> "sptr"; HRESULT StgCreatePropSetStg(IStorage* pStorage, DWORD dwReserved, IPropertySetStorage** ppPropSetStg)
#uselib "OLE32.dll"
#cfunc global StgCreatePropSetStg "StgCreatePropSetStg" intptr, int, intptr
; res = StgCreatePropSetStg(pStorage, dwReserved, ppPropSetStg)
; pStorage : IStorage* -> "intptr"
; dwReserved : DWORD optional -> "int"
; ppPropSetStg : IPropertySetStorage** out -> "intptr"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
ole32 = windows.NewLazySystemDLL("OLE32.dll")
procStgCreatePropSetStg = ole32.NewProc("StgCreatePropSetStg")
)
// pStorage (IStorage*), dwReserved (DWORD optional), ppPropSetStg (IPropertySetStorage** out)
r1, _, err := procStgCreatePropSetStg.Call(
uintptr(pStorage),
uintptr(dwReserved),
uintptr(ppPropSetStg),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HRESULTfunction StgCreatePropSetStg(
pStorage: Pointer; // IStorage*
dwReserved: DWORD; // DWORD optional
ppPropSetStg: Pointer // IPropertySetStorage** out
): Integer; stdcall;
external 'OLE32.dll' name 'StgCreatePropSetStg';result := DllCall("OLE32\StgCreatePropSetStg"
, "Ptr", pStorage ; IStorage*
, "UInt", dwReserved ; DWORD optional
, "Ptr", ppPropSetStg ; IPropertySetStorage** out
, "Int") ; return: HRESULT●StgCreatePropSetStg(pStorage, dwReserved, ppPropSetStg) = DLL("OLE32.dll", "int StgCreatePropSetStg(void*, dword, void*)")
# 呼び出し: StgCreatePropSetStg(pStorage, dwReserved, ppPropSetStg)
# pStorage : IStorage* -> "void*"
# dwReserved : DWORD optional -> "dword"
# ppPropSetStg : IPropertySetStorage** out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。const std = @import("std");
extern "ole32" fn StgCreatePropSetStg(
pStorage: ?*anyopaque, // IStorage*
dwReserved: u32, // DWORD optional
ppPropSetStg: ?*anyopaque // IPropertySetStorage** out
) callconv(std.os.windows.WINAPI) i32;proc StgCreatePropSetStg(
pStorage: pointer, # IStorage*
dwReserved: uint32, # DWORD optional
ppPropSetStg: pointer # IPropertySetStorage** out
): int32 {.importc: "StgCreatePropSetStg", stdcall, dynlib: "OLE32.dll".}pragma(lib, "ole32");
extern(Windows)
int StgCreatePropSetStg(
void* pStorage, // IStorage*
uint dwReserved, // DWORD optional
void* ppPropSetStg // IPropertySetStorage** out
);ccall((:StgCreatePropSetStg, "OLE32.dll"), stdcall, Int32,
(Ptr{Cvoid}, UInt32, Ptr{Cvoid}),
pStorage, dwReserved, ppPropSetStg)
# pStorage : IStorage* -> Ptr{Cvoid}
# dwReserved : DWORD optional -> UInt32
# ppPropSetStg : IPropertySetStorage** out -> Ptr{Cvoid}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
int32_t StgCreatePropSetStg(
void* pStorage,
uint32_t dwReserved,
void* ppPropSetStg);
]]
local ole32 = ffi.load("ole32")
-- ole32.StgCreatePropSetStg(pStorage, dwReserved, ppPropSetStg)
-- pStorage : IStorage*
-- dwReserved : DWORD optional
-- ppPropSetStg : IPropertySetStorage** out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('OLE32.dll');
const StgCreatePropSetStg = lib.func('__stdcall', 'StgCreatePropSetStg', 'int32_t', ['void *', 'uint32_t', 'void *']);
// StgCreatePropSetStg(pStorage, dwReserved, ppPropSetStg)
// pStorage : IStorage* -> 'void *'
// dwReserved : DWORD optional -> 'uint32_t'
// ppPropSetStg : IPropertySetStorage** out -> 'void *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("OLE32.dll", {
StgCreatePropSetStg: { parameters: ["pointer", "u32", "pointer"], result: "i32" },
});
// lib.symbols.StgCreatePropSetStg(pStorage, dwReserved, ppPropSetStg)
// pStorage : IStorage* -> "pointer"
// dwReserved : DWORD optional -> "u32"
// ppPropSetStg : IPropertySetStorage** out -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
int32_t StgCreatePropSetStg(
void* pStorage,
uint32_t dwReserved,
void* ppPropSetStg);
C, "OLE32.dll");
// $ffi->StgCreatePropSetStg(pStorage, dwReserved, ppPropSetStg);
// pStorage : IStorage*
// dwReserved : DWORD optional
// ppPropSetStg : IPropertySetStorage** 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 Ole32 extends StdCallLibrary {
Ole32 INSTANCE = Native.load("ole32", Ole32.class);
int StgCreatePropSetStg(
Pointer pStorage, // IStorage*
int dwReserved, // DWORD optional
Pointer ppPropSetStg // IPropertySetStorage** out
);
}@[Link("ole32")]
lib LibOLE32
fun StgCreatePropSetStg = StgCreatePropSetStg(
pStorage : Void*, # IStorage*
dwReserved : UInt32, # DWORD optional
ppPropSetStg : Void* # IPropertySetStorage** out
) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef StgCreatePropSetStgNative = Int32 Function(Pointer<Void>, Uint32, Pointer<Void>);
typedef StgCreatePropSetStgDart = int Function(Pointer<Void>, int, Pointer<Void>);
final StgCreatePropSetStg = DynamicLibrary.open('OLE32.dll')
.lookupFunction<StgCreatePropSetStgNative, StgCreatePropSetStgDart>('StgCreatePropSetStg');
// pStorage : IStorage* -> Pointer<Void>
// dwReserved : DWORD optional -> Uint32
// ppPropSetStg : IPropertySetStorage** out -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function StgCreatePropSetStg(
pStorage: Pointer; // IStorage*
dwReserved: DWORD; // DWORD optional
ppPropSetStg: Pointer // IPropertySetStorage** out
): Integer; stdcall;
external 'OLE32.dll' name 'StgCreatePropSetStg';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "StgCreatePropSetStg"
c_StgCreatePropSetStg :: Ptr () -> Word32 -> Ptr () -> IO Int32
-- pStorage : IStorage* -> Ptr ()
-- dwReserved : DWORD optional -> Word32
-- ppPropSetStg : IPropertySetStorage** out -> Ptr ()
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let stgcreatepropsetstg =
foreign "StgCreatePropSetStg"
((ptr void) @-> uint32_t @-> (ptr void) @-> returning int32_t)
(* pStorage : IStorage* -> (ptr void) *)
(* dwReserved : DWORD optional -> uint32_t *)
(* ppPropSetStg : IPropertySetStorage** out -> (ptr void) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library ole32 (t "OLE32.dll"))
(cffi:use-foreign-library ole32)
(cffi:defcfun ("StgCreatePropSetStg" stg-create-prop-set-stg :convention :stdcall) :int32
(p-storage :pointer) ; IStorage*
(dw-reserved :uint32) ; DWORD optional
(pp-prop-set-stg :pointer)) ; IPropertySetStorage** out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $StgCreatePropSetStg = Win32::API::More->new('OLE32',
'int StgCreatePropSetStg(LPVOID pStorage, DWORD dwReserved, LPVOID ppPropSetStg)');
# my $ret = $StgCreatePropSetStg->Call($pStorage, $dwReserved, $ppPropSetStg);
# pStorage : IStorage* -> LPVOID
# dwReserved : DWORD optional -> DWORD
# ppPropSetStg : IPropertySetStorage** out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。