Win32 API 日本語リファレンス
ホームStorage.ProjectedFileSystem › PrjMarkDirectoryAsPlaceholder

PrjMarkDirectoryAsPlaceholder

関数
ディレクトリを仮想化のプレースホルダーとして設定する。
DLLPROJECTEDFSLIB.dll呼出規約winapi対応OSWindows 10 以降

シグネチャ

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

HRESULT PrjMarkDirectoryAsPlaceholder(
    LPCWSTR rootPathName,
    LPCWSTR targetPathName,   // optional
    const PRJ_PLACEHOLDER_VERSION_INFO* versionInfo,   // optional
    const GUID* virtualizationInstanceID
);

パラメーター

名前方向
rootPathNameLPCWSTRin
targetPathNameLPCWSTRinoptional
versionInfoPRJ_PLACEHOLDER_VERSION_INFO*inoptional
virtualizationInstanceIDGUID*in

戻り値の型: 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 方式にも切替可。
出力引数:
; 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 方式にも切替可。
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   // HRESULT
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';
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)。