Win32 API 日本語リファレンス
ホームWeb.InternetExplorer › IEGetWriteableFolderPath

IEGetWriteableFolderPath

関数
書き込み可能なフォルダのパスを取得する。
DLLIeframe.dll呼出規約winapi

シグネチャ

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

HRESULT IEGetWriteableFolderPath(
    const GUID* clsidFolderID,
    LPWSTR* lppwstrPath
);

パラメーター

名前方向説明
clsidFolderIDGUID*in対象とする既知フォルダのIDを示すGUIDへのポインタ。
lppwstrPathLPWSTR*out保護モードで書き込み可能なフォルダパスを受け取る出力ポインタ。

戻り値の型: HRESULT

各言語での呼び出し定義

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

HRESULT IEGetWriteableFolderPath(
    const GUID* clsidFolderID,
    LPWSTR* lppwstrPath
);
[DllImport("Ieframe.dll", ExactSpelling = true)]
static extern int IEGetWriteableFolderPath(
    ref Guid clsidFolderID,   // GUID*
    IntPtr lppwstrPath   // LPWSTR* out
);
<DllImport("Ieframe.dll", ExactSpelling:=True)>
Public Shared Function IEGetWriteableFolderPath(
    ByRef clsidFolderID As Guid,   ' GUID*
    lppwstrPath As IntPtr   ' LPWSTR* out
) As Integer
End Function
' clsidFolderID : GUID*
' lppwstrPath : LPWSTR* out
Declare PtrSafe Function IEGetWriteableFolderPath Lib "ieframe" ( _
    ByVal clsidFolderID As LongPtr, _
    ByVal lppwstrPath As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

IEGetWriteableFolderPath = ctypes.windll.ieframe.IEGetWriteableFolderPath
IEGetWriteableFolderPath.restype = ctypes.c_int
IEGetWriteableFolderPath.argtypes = [
    ctypes.c_void_p,  # clsidFolderID : GUID*
    ctypes.c_void_p,  # lppwstrPath : LPWSTR* out
]
require 'fiddle'
require 'fiddle/import'

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

var (
	ieframe = windows.NewLazySystemDLL("Ieframe.dll")
	procIEGetWriteableFolderPath = ieframe.NewProc("IEGetWriteableFolderPath")
)

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

extern "ieframe" fn IEGetWriteableFolderPath(
    clsidFolderID: [*c]GUID, // GUID*
    lppwstrPath: [*c][*c]u16 // LPWSTR* out
) callconv(std.os.windows.WINAPI) i32;
proc IEGetWriteableFolderPath(
    clsidFolderID: ptr GUID,  # GUID*
    lppwstrPath: ptr WideCString  # LPWSTR* out
): int32 {.importc: "IEGetWriteableFolderPath", stdcall, dynlib: "Ieframe.dll".}
pragma(lib, "ieframe");
extern(Windows)
int IEGetWriteableFolderPath(
    GUID* clsidFolderID,   // GUID*
    wchar** lppwstrPath   // LPWSTR* out
);
ccall((:IEGetWriteableFolderPath, "Ieframe.dll"), stdcall, Int32,
      (Ptr{GUID}, Ptr{Ptr{UInt16}}),
      clsidFolderID, lppwstrPath)
# clsidFolderID : GUID* -> Ptr{GUID}
# lppwstrPath : LPWSTR* out -> Ptr{Ptr{UInt16}}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。
local ffi = require("ffi")
ffi.cdef[[
int32_t IEGetWriteableFolderPath(
    void* clsidFolderID,
    uint16_t** lppwstrPath);
]]
local ieframe = ffi.load("ieframe")
-- ieframe.IEGetWriteableFolderPath(clsidFolderID, lppwstrPath)
-- clsidFolderID : GUID*
-- lppwstrPath : LPWSTR* out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
const koffi = require('koffi');
const lib = koffi.load('Ieframe.dll');
const IEGetWriteableFolderPath = lib.func('__stdcall', 'IEGetWriteableFolderPath', 'int32_t', ['void *', 'void *']);
// IEGetWriteableFolderPath(clsidFolderID, lppwstrPath)
// clsidFolderID : GUID* -> 'void *'
// lppwstrPath : LPWSTR* out -> 'void *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
const lib = Deno.dlopen("Ieframe.dll", {
  IEGetWriteableFolderPath: { parameters: ["pointer", "pointer"], result: "i32" },
});
// lib.symbols.IEGetWriteableFolderPath(clsidFolderID, lppwstrPath)
// clsidFolderID : GUID* -> "pointer"
// lppwstrPath : LPWSTR* out -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。
<?php
$ffi = FFI::cdef(<<<C
int32_t IEGetWriteableFolderPath(
    void* clsidFolderID,
    uint16_t** lppwstrPath);
C, "Ieframe.dll");
// $ffi->IEGetWriteableFolderPath(clsidFolderID, lppwstrPath);
// clsidFolderID : GUID*
// lppwstrPath : LPWSTR* 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 Ieframe extends StdCallLibrary {
    Ieframe INSTANCE = Native.load("ieframe", Ieframe.class);
    int IEGetWriteableFolderPath(
        Pointer clsidFolderID,   // GUID*
        PointerByReference lppwstrPath   // LPWSTR* out
    );
}
@[Link("ieframe")]
lib LibIeframe
  fun IEGetWriteableFolderPath = IEGetWriteableFolderPath(
    clsidFolderID : GUID*,   # GUID*
    lppwstrPath : UInt16**   # LPWSTR* out
  ) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。
import 'dart:ffi';
import 'package:ffi/ffi.dart';

typedef IEGetWriteableFolderPathNative = Int32 Function(Pointer<Void>, Pointer<Pointer<Utf16>>);
typedef IEGetWriteableFolderPathDart = int Function(Pointer<Void>, Pointer<Pointer<Utf16>>);
final IEGetWriteableFolderPath = DynamicLibrary.open('Ieframe.dll')
    .lookupFunction<IEGetWriteableFolderPathNative, IEGetWriteableFolderPathDart>('IEGetWriteableFolderPath');
// clsidFolderID : GUID* -> Pointer<Void>
// lppwstrPath : LPWSTR* out -> Pointer<Pointer<Utf16>>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
function IEGetWriteableFolderPath(
  clsidFolderID: PGUID;   // GUID*
  lppwstrPath: PPWideChar   // LPWSTR* out
): Integer; stdcall;
  external 'Ieframe.dll' name 'IEGetWriteableFolderPath';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import stdcall safe "IEGetWriteableFolderPath"
  c_IEGetWriteableFolderPath :: Ptr () -> Ptr CWString -> IO Int32
-- clsidFolderID : GUID* -> Ptr ()
-- lppwstrPath : LPWSTR* out -> Ptr CWString
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let iegetwriteablefolderpath =
  foreign "IEGetWriteableFolderPath"
    ((ptr void) @-> (ptr (ptr uint16_t)) @-> returning int32_t)
(* clsidFolderID : GUID* -> (ptr void) *)
(* lppwstrPath : LPWSTR* out -> (ptr (ptr uint16_t)) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)
(cffi:define-foreign-library ieframe (t "Ieframe.dll"))
(cffi:use-foreign-library ieframe)

(cffi:defcfun ("IEGetWriteableFolderPath" ieget-writeable-folder-path :convention :stdcall) :int32
  (clsid-folder-id :pointer)   ; GUID*
  (lppwstr-path :pointer))   ; LPWSTR* out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $IEGetWriteableFolderPath = Win32::API::More->new('Ieframe',
    'int IEGetWriteableFolderPath(LPVOID clsidFolderID, LPVOID lppwstrPath)');
# my $ret = $IEGetWriteableFolderPath->Call($clsidFolderID, $lppwstrPath);
# clsidFolderID : GUID* -> LPVOID
# lppwstrPath : LPWSTR* out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。