ホーム › Storage.ProjectedFileSystem › PrjMarkDirectoryAsPlaceholder
PrjMarkDirectoryAsPlaceholder
関数ディレクトリを仮想化のプレースホルダーとして設定する。
シグネチャ
// PROJECTEDFSLIB.dll
#include <windows.h>
HRESULT PrjMarkDirectoryAsPlaceholder(
LPCWSTR rootPathName,
LPCWSTR targetPathName, // optional
const PRJ_PLACEHOLDER_VERSION_INFO* versionInfo, // optional
const GUID* virtualizationInstanceID
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| rootPathName | LPCWSTR | in | 仮想化ルートのパス文字列。 |
| targetPathName | LPCWSTR | inoptional | プレースホルダーとしてマークする対象ディレクトリのパス文字列。 |
| versionInfo | PRJ_PLACEHOLDER_VERSION_INFO* | inoptional | プレースホルダーに付与するバージョン情報構造体へのポインタ。NULL可。 |
| virtualizationInstanceID | GUID* | in | 対象仮想化インスタンスを示すGUIDへのポインタ。NULL可。 |
戻り値の型: HRESULT
各言語での呼び出し定義
// PROJECTEDFSLIB.dll
#include <windows.h>
HRESULT PrjMarkDirectoryAsPlaceholder(
LPCWSTR rootPathName,
LPCWSTR targetPathName, // optional
const PRJ_PLACEHOLDER_VERSION_INFO* versionInfo, // optional
const GUID* virtualizationInstanceID
);[DllImport("PROJECTEDFSLIB.dll", ExactSpelling = true)]
static extern int PrjMarkDirectoryAsPlaceholder(
[MarshalAs(UnmanagedType.LPWStr)] string rootPathName, // LPCWSTR
[MarshalAs(UnmanagedType.LPWStr)] string targetPathName, // LPCWSTR optional
IntPtr versionInfo, // PRJ_PLACEHOLDER_VERSION_INFO* optional
ref Guid virtualizationInstanceID // GUID*
);<DllImport("PROJECTEDFSLIB.dll", ExactSpelling:=True)>
Public Shared Function PrjMarkDirectoryAsPlaceholder(
<MarshalAs(UnmanagedType.LPWStr)> rootPathName As String, ' LPCWSTR
<MarshalAs(UnmanagedType.LPWStr)> targetPathName As String, ' LPCWSTR optional
versionInfo As IntPtr, ' PRJ_PLACEHOLDER_VERSION_INFO* optional
ByRef virtualizationInstanceID As Guid ' GUID*
) As Integer
End Function' rootPathName : LPCWSTR
' targetPathName : LPCWSTR optional
' versionInfo : PRJ_PLACEHOLDER_VERSION_INFO* optional
' virtualizationInstanceID : GUID*
Declare PtrSafe Function PrjMarkDirectoryAsPlaceholder Lib "projectedfslib" ( _
ByVal rootPathName As LongPtr, _
ByVal targetPathName As LongPtr, _
ByVal versionInfo As LongPtr, _
ByVal virtualizationInstanceID As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
PrjMarkDirectoryAsPlaceholder = ctypes.windll.projectedfslib.PrjMarkDirectoryAsPlaceholder
PrjMarkDirectoryAsPlaceholder.restype = ctypes.c_int
PrjMarkDirectoryAsPlaceholder.argtypes = [
wintypes.LPCWSTR, # rootPathName : LPCWSTR
wintypes.LPCWSTR, # targetPathName : LPCWSTR optional
ctypes.c_void_p, # versionInfo : PRJ_PLACEHOLDER_VERSION_INFO* optional
ctypes.c_void_p, # virtualizationInstanceID : GUID*
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('PROJECTEDFSLIB.dll')
PrjMarkDirectoryAsPlaceholder = Fiddle::Function.new(
lib['PrjMarkDirectoryAsPlaceholder'],
[
Fiddle::TYPE_VOIDP, # rootPathName : LPCWSTR
Fiddle::TYPE_VOIDP, # targetPathName : LPCWSTR optional
Fiddle::TYPE_VOIDP, # versionInfo : PRJ_PLACEHOLDER_VERSION_INFO* optional
Fiddle::TYPE_VOIDP, # virtualizationInstanceID : GUID*
],
Fiddle::TYPE_INT)#[link(name = "projectedfslib")]
extern "system" {
fn PrjMarkDirectoryAsPlaceholder(
rootPathName: *const u16, // LPCWSTR
targetPathName: *const u16, // LPCWSTR optional
versionInfo: *const PRJ_PLACEHOLDER_VERSION_INFO, // PRJ_PLACEHOLDER_VERSION_INFO* optional
virtualizationInstanceID: *const GUID // GUID*
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("PROJECTEDFSLIB.dll")]
public static extern int PrjMarkDirectoryAsPlaceholder([MarshalAs(UnmanagedType.LPWStr)] string rootPathName, [MarshalAs(UnmanagedType.LPWStr)] string targetPathName, IntPtr versionInfo, ref Guid virtualizationInstanceID);
"@
$api = Add-Type -MemberDefinition $sig -Name 'PROJECTEDFSLIB_PrjMarkDirectoryAsPlaceholder' -Namespace Win32 -PassThru
# $api::PrjMarkDirectoryAsPlaceholder(rootPathName, targetPathName, versionInfo, virtualizationInstanceID)#uselib "PROJECTEDFSLIB.dll"
#func global PrjMarkDirectoryAsPlaceholder "PrjMarkDirectoryAsPlaceholder" sptr, sptr, sptr, sptr
; PrjMarkDirectoryAsPlaceholder rootPathName, targetPathName, varptr(versionInfo), varptr(virtualizationInstanceID) ; 戻り値は stat
; rootPathName : LPCWSTR -> "sptr"
; targetPathName : LPCWSTR optional -> "sptr"
; versionInfo : PRJ_PLACEHOLDER_VERSION_INFO* optional -> "sptr"
; virtualizationInstanceID : GUID* -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "PROJECTEDFSLIB.dll" #cfunc global PrjMarkDirectoryAsPlaceholder "PrjMarkDirectoryAsPlaceholder" wstr, wstr, var, var ; res = PrjMarkDirectoryAsPlaceholder(rootPathName, targetPathName, versionInfo, virtualizationInstanceID) ; rootPathName : LPCWSTR -> "wstr" ; targetPathName : LPCWSTR optional -> "wstr" ; versionInfo : PRJ_PLACEHOLDER_VERSION_INFO* optional -> "var" ; virtualizationInstanceID : GUID* -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "PROJECTEDFSLIB.dll" #cfunc global PrjMarkDirectoryAsPlaceholder "PrjMarkDirectoryAsPlaceholder" wstr, wstr, sptr, sptr ; res = PrjMarkDirectoryAsPlaceholder(rootPathName, targetPathName, varptr(versionInfo), varptr(virtualizationInstanceID)) ; rootPathName : LPCWSTR -> "wstr" ; targetPathName : LPCWSTR optional -> "wstr" ; versionInfo : PRJ_PLACEHOLDER_VERSION_INFO* optional -> "sptr" ; virtualizationInstanceID : GUID* -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; HRESULT PrjMarkDirectoryAsPlaceholder(LPCWSTR rootPathName, LPCWSTR targetPathName, PRJ_PLACEHOLDER_VERSION_INFO* versionInfo, GUID* virtualizationInstanceID) #uselib "PROJECTEDFSLIB.dll" #cfunc global PrjMarkDirectoryAsPlaceholder "PrjMarkDirectoryAsPlaceholder" wstr, wstr, var, var ; res = PrjMarkDirectoryAsPlaceholder(rootPathName, targetPathName, versionInfo, virtualizationInstanceID) ; rootPathName : LPCWSTR -> "wstr" ; targetPathName : LPCWSTR optional -> "wstr" ; versionInfo : PRJ_PLACEHOLDER_VERSION_INFO* optional -> "var" ; virtualizationInstanceID : GUID* -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; HRESULT PrjMarkDirectoryAsPlaceholder(LPCWSTR rootPathName, LPCWSTR targetPathName, PRJ_PLACEHOLDER_VERSION_INFO* versionInfo, GUID* virtualizationInstanceID) #uselib "PROJECTEDFSLIB.dll" #cfunc global PrjMarkDirectoryAsPlaceholder "PrjMarkDirectoryAsPlaceholder" wstr, wstr, intptr, intptr ; res = PrjMarkDirectoryAsPlaceholder(rootPathName, targetPathName, varptr(versionInfo), varptr(virtualizationInstanceID)) ; rootPathName : LPCWSTR -> "wstr" ; targetPathName : LPCWSTR optional -> "wstr" ; versionInfo : PRJ_PLACEHOLDER_VERSION_INFO* optional -> "intptr" ; virtualizationInstanceID : GUID* -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
projectedfslib = windows.NewLazySystemDLL("PROJECTEDFSLIB.dll")
procPrjMarkDirectoryAsPlaceholder = projectedfslib.NewProc("PrjMarkDirectoryAsPlaceholder")
)
// rootPathName (LPCWSTR), targetPathName (LPCWSTR optional), versionInfo (PRJ_PLACEHOLDER_VERSION_INFO* optional), virtualizationInstanceID (GUID*)
r1, _, err := procPrjMarkDirectoryAsPlaceholder.Call(
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(rootPathName))),
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(targetPathName))),
uintptr(versionInfo),
uintptr(virtualizationInstanceID),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HRESULTfunction PrjMarkDirectoryAsPlaceholder(
rootPathName: PWideChar; // LPCWSTR
targetPathName: PWideChar; // LPCWSTR optional
versionInfo: Pointer; // PRJ_PLACEHOLDER_VERSION_INFO* optional
virtualizationInstanceID: PGUID // GUID*
): Integer; stdcall;
external 'PROJECTEDFSLIB.dll' name 'PrjMarkDirectoryAsPlaceholder';result := DllCall("PROJECTEDFSLIB\PrjMarkDirectoryAsPlaceholder"
, "WStr", rootPathName ; LPCWSTR
, "WStr", targetPathName ; LPCWSTR optional
, "Ptr", versionInfo ; PRJ_PLACEHOLDER_VERSION_INFO* optional
, "Ptr", virtualizationInstanceID ; GUID*
, "Int") ; return: HRESULT●PrjMarkDirectoryAsPlaceholder(rootPathName, targetPathName, versionInfo, virtualizationInstanceID) = DLL("PROJECTEDFSLIB.dll", "int PrjMarkDirectoryAsPlaceholder(char*, char*, void*, void*)")
# 呼び出し: PrjMarkDirectoryAsPlaceholder(rootPathName, targetPathName, versionInfo, virtualizationInstanceID)
# rootPathName : LPCWSTR -> "char*"
# targetPathName : LPCWSTR optional -> "char*"
# versionInfo : PRJ_PLACEHOLDER_VERSION_INFO* optional -> "void*"
# virtualizationInstanceID : GUID* -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。const std = @import("std");
extern "projectedfslib" fn PrjMarkDirectoryAsPlaceholder(
rootPathName: [*c]const u16, // LPCWSTR
targetPathName: [*c]const u16, // LPCWSTR optional
versionInfo: [*c]PRJ_PLACEHOLDER_VERSION_INFO, // PRJ_PLACEHOLDER_VERSION_INFO* optional
virtualizationInstanceID: [*c]GUID // GUID*
) callconv(std.os.windows.WINAPI) i32;proc PrjMarkDirectoryAsPlaceholder(
rootPathName: WideCString, # LPCWSTR
targetPathName: WideCString, # LPCWSTR optional
versionInfo: ptr PRJ_PLACEHOLDER_VERSION_INFO, # PRJ_PLACEHOLDER_VERSION_INFO* optional
virtualizationInstanceID: ptr GUID # GUID*
): int32 {.importc: "PrjMarkDirectoryAsPlaceholder", stdcall, dynlib: "PROJECTEDFSLIB.dll".}pragma(lib, "projectedfslib");
extern(Windows)
int PrjMarkDirectoryAsPlaceholder(
const(wchar)* rootPathName, // LPCWSTR
const(wchar)* targetPathName, // LPCWSTR optional
PRJ_PLACEHOLDER_VERSION_INFO* versionInfo, // PRJ_PLACEHOLDER_VERSION_INFO* optional
GUID* virtualizationInstanceID // GUID*
);ccall((:PrjMarkDirectoryAsPlaceholder, "PROJECTEDFSLIB.dll"), stdcall, Int32,
(Cwstring, Cwstring, Ptr{PRJ_PLACEHOLDER_VERSION_INFO}, Ptr{GUID}),
rootPathName, targetPathName, versionInfo, virtualizationInstanceID)
# rootPathName : LPCWSTR -> Cwstring
# targetPathName : LPCWSTR optional -> Cwstring
# versionInfo : PRJ_PLACEHOLDER_VERSION_INFO* optional -> Ptr{PRJ_PLACEHOLDER_VERSION_INFO}
# virtualizationInstanceID : GUID* -> Ptr{GUID}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
int32_t PrjMarkDirectoryAsPlaceholder(
const uint16_t* rootPathName,
const uint16_t* targetPathName,
void* versionInfo,
void* virtualizationInstanceID);
]]
local projectedfslib = ffi.load("projectedfslib")
-- projectedfslib.PrjMarkDirectoryAsPlaceholder(rootPathName, targetPathName, versionInfo, virtualizationInstanceID)
-- rootPathName : LPCWSTR
-- targetPathName : LPCWSTR optional
-- versionInfo : PRJ_PLACEHOLDER_VERSION_INFO* optional
-- virtualizationInstanceID : GUID*
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('PROJECTEDFSLIB.dll');
const PrjMarkDirectoryAsPlaceholder = lib.func('__stdcall', 'PrjMarkDirectoryAsPlaceholder', 'int32_t', ['str16', 'str16', 'void *', 'void *']);
// PrjMarkDirectoryAsPlaceholder(rootPathName, targetPathName, versionInfo, virtualizationInstanceID)
// rootPathName : LPCWSTR -> 'str16'
// targetPathName : LPCWSTR optional -> 'str16'
// versionInfo : PRJ_PLACEHOLDER_VERSION_INFO* optional -> 'void *'
// virtualizationInstanceID : GUID* -> 'void *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("PROJECTEDFSLIB.dll", {
PrjMarkDirectoryAsPlaceholder: { parameters: ["buffer", "buffer", "pointer", "pointer"], result: "i32" },
});
// lib.symbols.PrjMarkDirectoryAsPlaceholder(rootPathName, targetPathName, versionInfo, virtualizationInstanceID)
// rootPathName : LPCWSTR -> "buffer"
// targetPathName : LPCWSTR optional -> "buffer"
// versionInfo : PRJ_PLACEHOLDER_VERSION_INFO* optional -> "pointer"
// virtualizationInstanceID : GUID* -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
int32_t PrjMarkDirectoryAsPlaceholder(
const uint16_t* rootPathName,
const uint16_t* targetPathName,
void* versionInfo,
void* virtualizationInstanceID);
C, "PROJECTEDFSLIB.dll");
// $ffi->PrjMarkDirectoryAsPlaceholder(rootPathName, targetPathName, versionInfo, virtualizationInstanceID);
// rootPathName : LPCWSTR
// targetPathName : LPCWSTR optional
// versionInfo : PRJ_PLACEHOLDER_VERSION_INFO* optional
// virtualizationInstanceID : GUID*
// 構造体/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 Projectedfslib extends StdCallLibrary {
Projectedfslib INSTANCE = Native.load("projectedfslib", Projectedfslib.class);
int PrjMarkDirectoryAsPlaceholder(
WString rootPathName, // LPCWSTR
WString targetPathName, // LPCWSTR optional
Pointer versionInfo, // PRJ_PLACEHOLDER_VERSION_INFO* optional
Pointer virtualizationInstanceID // GUID*
);
}@[Link("projectedfslib")]
lib LibPROJECTEDFSLIB
fun PrjMarkDirectoryAsPlaceholder = PrjMarkDirectoryAsPlaceholder(
rootPathName : UInt16*, # LPCWSTR
targetPathName : UInt16*, # LPCWSTR optional
versionInfo : PRJ_PLACEHOLDER_VERSION_INFO*, # PRJ_PLACEHOLDER_VERSION_INFO* optional
virtualizationInstanceID : GUID* # GUID*
) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef PrjMarkDirectoryAsPlaceholderNative = Int32 Function(Pointer<Utf16>, Pointer<Utf16>, Pointer<Void>, Pointer<Void>);
typedef PrjMarkDirectoryAsPlaceholderDart = int Function(Pointer<Utf16>, Pointer<Utf16>, Pointer<Void>, Pointer<Void>);
final PrjMarkDirectoryAsPlaceholder = DynamicLibrary.open('PROJECTEDFSLIB.dll')
.lookupFunction<PrjMarkDirectoryAsPlaceholderNative, PrjMarkDirectoryAsPlaceholderDart>('PrjMarkDirectoryAsPlaceholder');
// rootPathName : LPCWSTR -> Pointer<Utf16>
// targetPathName : LPCWSTR optional -> Pointer<Utf16>
// versionInfo : PRJ_PLACEHOLDER_VERSION_INFO* optional -> Pointer<Void>
// virtualizationInstanceID : GUID* -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function PrjMarkDirectoryAsPlaceholder(
rootPathName: PWideChar; // LPCWSTR
targetPathName: PWideChar; // LPCWSTR optional
versionInfo: Pointer; // PRJ_PLACEHOLDER_VERSION_INFO* optional
virtualizationInstanceID: PGUID // GUID*
): Integer; stdcall;
external 'PROJECTEDFSLIB.dll' name 'PrjMarkDirectoryAsPlaceholder';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "PrjMarkDirectoryAsPlaceholder"
c_PrjMarkDirectoryAsPlaceholder :: CWString -> CWString -> Ptr () -> Ptr () -> IO Int32
-- rootPathName : LPCWSTR -> CWString
-- targetPathName : LPCWSTR optional -> CWString
-- versionInfo : PRJ_PLACEHOLDER_VERSION_INFO* optional -> Ptr ()
-- virtualizationInstanceID : GUID* -> Ptr ()
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let prjmarkdirectoryasplaceholder =
foreign "PrjMarkDirectoryAsPlaceholder"
((ptr uint16_t) @-> (ptr uint16_t) @-> (ptr void) @-> (ptr void) @-> returning int32_t)
(* rootPathName : LPCWSTR -> (ptr uint16_t) *)
(* targetPathName : LPCWSTR optional -> (ptr uint16_t) *)
(* versionInfo : PRJ_PLACEHOLDER_VERSION_INFO* optional -> (ptr void) *)
(* virtualizationInstanceID : GUID* -> (ptr void) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library projectedfslib (t "PROJECTEDFSLIB.dll"))
(cffi:use-foreign-library projectedfslib)
(cffi:defcfun ("PrjMarkDirectoryAsPlaceholder" prj-mark-directory-as-placeholder :convention :stdcall) :int32
(root-path-name (:string :encoding :utf-16le)) ; LPCWSTR
(target-path-name (:string :encoding :utf-16le)) ; LPCWSTR optional
(version-info :pointer) ; PRJ_PLACEHOLDER_VERSION_INFO* optional
(virtualization-instance-id :pointer)) ; GUID*
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $PrjMarkDirectoryAsPlaceholder = Win32::API::More->new('PROJECTEDFSLIB',
'int PrjMarkDirectoryAsPlaceholder(LPCWSTR rootPathName, LPCWSTR targetPathName, LPVOID versionInfo, LPVOID virtualizationInstanceID)');
# my $ret = $PrjMarkDirectoryAsPlaceholder->Call($rootPathName, $targetPathName, $versionInfo, $virtualizationInstanceID);
# rootPathName : LPCWSTR -> LPCWSTR
# targetPathName : LPCWSTR optional -> LPCWSTR
# versionInfo : PRJ_PLACEHOLDER_VERSION_INFO* optional -> LPVOID
# virtualizationInstanceID : GUID* -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。