ホーム › Storage.CloudFilters › CfGetSyncRootInfoByPath
CfGetSyncRootInfoByPath
関数パス指定で同期ルートの情報を取得する。
シグネチャ
// cldapi.dll
#include <windows.h>
HRESULT CfGetSyncRootInfoByPath(
LPCWSTR FilePath,
CF_SYNC_ROOT_INFO_CLASS InfoClass,
void* InfoBuffer,
DWORD InfoBufferLength,
DWORD* ReturnedLength // optional
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| FilePath | LPCWSTR | in |
| InfoClass | CF_SYNC_ROOT_INFO_CLASS | in |
| InfoBuffer | void* | out |
| InfoBufferLength | DWORD | in |
| ReturnedLength | DWORD* | outoptional |
戻り値の型: HRESULT
各言語での呼び出し定義
// cldapi.dll
#include <windows.h>
HRESULT CfGetSyncRootInfoByPath(
LPCWSTR FilePath,
CF_SYNC_ROOT_INFO_CLASS InfoClass,
void* InfoBuffer,
DWORD InfoBufferLength,
DWORD* ReturnedLength // optional
);[DllImport("cldapi.dll", ExactSpelling = true)]
static extern int CfGetSyncRootInfoByPath(
[MarshalAs(UnmanagedType.LPWStr)] string FilePath, // LPCWSTR
int InfoClass, // CF_SYNC_ROOT_INFO_CLASS
IntPtr InfoBuffer, // void* out
uint InfoBufferLength, // DWORD
IntPtr ReturnedLength // DWORD* optional, out
);<DllImport("cldapi.dll", ExactSpelling:=True)>
Public Shared Function CfGetSyncRootInfoByPath(
<MarshalAs(UnmanagedType.LPWStr)> FilePath As String, ' LPCWSTR
InfoClass As Integer, ' CF_SYNC_ROOT_INFO_CLASS
InfoBuffer As IntPtr, ' void* out
InfoBufferLength As UInteger, ' DWORD
ReturnedLength As IntPtr ' DWORD* optional, out
) As Integer
End Function' FilePath : LPCWSTR
' InfoClass : CF_SYNC_ROOT_INFO_CLASS
' InfoBuffer : void* out
' InfoBufferLength : DWORD
' ReturnedLength : DWORD* optional, out
Declare PtrSafe Function CfGetSyncRootInfoByPath Lib "cldapi" ( _
ByVal FilePath As LongPtr, _
ByVal InfoClass As Long, _
ByVal InfoBuffer As LongPtr, _
ByVal InfoBufferLength As Long, _
ByVal ReturnedLength As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
CfGetSyncRootInfoByPath = ctypes.windll.cldapi.CfGetSyncRootInfoByPath
CfGetSyncRootInfoByPath.restype = ctypes.c_int
CfGetSyncRootInfoByPath.argtypes = [
wintypes.LPCWSTR, # FilePath : LPCWSTR
ctypes.c_int, # InfoClass : CF_SYNC_ROOT_INFO_CLASS
ctypes.POINTER(None), # InfoBuffer : void* out
wintypes.DWORD, # InfoBufferLength : DWORD
ctypes.POINTER(wintypes.DWORD), # ReturnedLength : DWORD* optional, out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('cldapi.dll')
CfGetSyncRootInfoByPath = Fiddle::Function.new(
lib['CfGetSyncRootInfoByPath'],
[
Fiddle::TYPE_VOIDP, # FilePath : LPCWSTR
Fiddle::TYPE_INT, # InfoClass : CF_SYNC_ROOT_INFO_CLASS
Fiddle::TYPE_VOIDP, # InfoBuffer : void* out
-Fiddle::TYPE_INT, # InfoBufferLength : DWORD
Fiddle::TYPE_VOIDP, # ReturnedLength : DWORD* optional, out
],
Fiddle::TYPE_INT)#[link(name = "cldapi")]
extern "system" {
fn CfGetSyncRootInfoByPath(
FilePath: *const u16, // LPCWSTR
InfoClass: i32, // CF_SYNC_ROOT_INFO_CLASS
InfoBuffer: *mut (), // void* out
InfoBufferLength: u32, // DWORD
ReturnedLength: *mut u32 // DWORD* optional, out
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("cldapi.dll")]
public static extern int CfGetSyncRootInfoByPath([MarshalAs(UnmanagedType.LPWStr)] string FilePath, int InfoClass, IntPtr InfoBuffer, uint InfoBufferLength, IntPtr ReturnedLength);
"@
$api = Add-Type -MemberDefinition $sig -Name 'cldapi_CfGetSyncRootInfoByPath' -Namespace Win32 -PassThru
# $api::CfGetSyncRootInfoByPath(FilePath, InfoClass, InfoBuffer, InfoBufferLength, ReturnedLength)#uselib "cldapi.dll"
#func global CfGetSyncRootInfoByPath "CfGetSyncRootInfoByPath" sptr, sptr, sptr, sptr, sptr
; CfGetSyncRootInfoByPath FilePath, InfoClass, InfoBuffer, InfoBufferLength, varptr(ReturnedLength) ; 戻り値は stat
; FilePath : LPCWSTR -> "sptr"
; InfoClass : CF_SYNC_ROOT_INFO_CLASS -> "sptr"
; InfoBuffer : void* out -> "sptr"
; InfoBufferLength : DWORD -> "sptr"
; ReturnedLength : DWORD* optional, out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "cldapi.dll" #cfunc global CfGetSyncRootInfoByPath "CfGetSyncRootInfoByPath" wstr, int, sptr, int, var ; res = CfGetSyncRootInfoByPath(FilePath, InfoClass, InfoBuffer, InfoBufferLength, ReturnedLength) ; FilePath : LPCWSTR -> "wstr" ; InfoClass : CF_SYNC_ROOT_INFO_CLASS -> "int" ; InfoBuffer : void* out -> "sptr" ; InfoBufferLength : DWORD -> "int" ; ReturnedLength : DWORD* optional, out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "cldapi.dll" #cfunc global CfGetSyncRootInfoByPath "CfGetSyncRootInfoByPath" wstr, int, sptr, int, sptr ; res = CfGetSyncRootInfoByPath(FilePath, InfoClass, InfoBuffer, InfoBufferLength, varptr(ReturnedLength)) ; FilePath : LPCWSTR -> "wstr" ; InfoClass : CF_SYNC_ROOT_INFO_CLASS -> "int" ; InfoBuffer : void* out -> "sptr" ; InfoBufferLength : DWORD -> "int" ; ReturnedLength : DWORD* optional, out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; HRESULT CfGetSyncRootInfoByPath(LPCWSTR FilePath, CF_SYNC_ROOT_INFO_CLASS InfoClass, void* InfoBuffer, DWORD InfoBufferLength, DWORD* ReturnedLength) #uselib "cldapi.dll" #cfunc global CfGetSyncRootInfoByPath "CfGetSyncRootInfoByPath" wstr, int, intptr, int, var ; res = CfGetSyncRootInfoByPath(FilePath, InfoClass, InfoBuffer, InfoBufferLength, ReturnedLength) ; FilePath : LPCWSTR -> "wstr" ; InfoClass : CF_SYNC_ROOT_INFO_CLASS -> "int" ; InfoBuffer : void* out -> "intptr" ; InfoBufferLength : DWORD -> "int" ; ReturnedLength : DWORD* optional, out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; HRESULT CfGetSyncRootInfoByPath(LPCWSTR FilePath, CF_SYNC_ROOT_INFO_CLASS InfoClass, void* InfoBuffer, DWORD InfoBufferLength, DWORD* ReturnedLength) #uselib "cldapi.dll" #cfunc global CfGetSyncRootInfoByPath "CfGetSyncRootInfoByPath" wstr, int, intptr, int, intptr ; res = CfGetSyncRootInfoByPath(FilePath, InfoClass, InfoBuffer, InfoBufferLength, varptr(ReturnedLength)) ; FilePath : LPCWSTR -> "wstr" ; InfoClass : CF_SYNC_ROOT_INFO_CLASS -> "int" ; InfoBuffer : void* out -> "intptr" ; InfoBufferLength : DWORD -> "int" ; ReturnedLength : DWORD* optional, out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
cldapi = windows.NewLazySystemDLL("cldapi.dll")
procCfGetSyncRootInfoByPath = cldapi.NewProc("CfGetSyncRootInfoByPath")
)
// FilePath (LPCWSTR), InfoClass (CF_SYNC_ROOT_INFO_CLASS), InfoBuffer (void* out), InfoBufferLength (DWORD), ReturnedLength (DWORD* optional, out)
r1, _, err := procCfGetSyncRootInfoByPath.Call(
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(FilePath))),
uintptr(InfoClass),
uintptr(InfoBuffer),
uintptr(InfoBufferLength),
uintptr(ReturnedLength),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HRESULTfunction CfGetSyncRootInfoByPath(
FilePath: PWideChar; // LPCWSTR
InfoClass: Integer; // CF_SYNC_ROOT_INFO_CLASS
InfoBuffer: Pointer; // void* out
InfoBufferLength: DWORD; // DWORD
ReturnedLength: Pointer // DWORD* optional, out
): Integer; stdcall;
external 'cldapi.dll' name 'CfGetSyncRootInfoByPath';result := DllCall("cldapi\CfGetSyncRootInfoByPath"
, "WStr", FilePath ; LPCWSTR
, "Int", InfoClass ; CF_SYNC_ROOT_INFO_CLASS
, "Ptr", InfoBuffer ; void* out
, "UInt", InfoBufferLength ; DWORD
, "Ptr", ReturnedLength ; DWORD* optional, out
, "Int") ; return: HRESULT●CfGetSyncRootInfoByPath(FilePath, InfoClass, InfoBuffer, InfoBufferLength, ReturnedLength) = DLL("cldapi.dll", "int CfGetSyncRootInfoByPath(char*, int, void*, dword, void*)")
# 呼び出し: CfGetSyncRootInfoByPath(FilePath, InfoClass, InfoBuffer, InfoBufferLength, ReturnedLength)
# FilePath : LPCWSTR -> "char*"
# InfoClass : CF_SYNC_ROOT_INFO_CLASS -> "int"
# InfoBuffer : void* out -> "void*"
# InfoBufferLength : DWORD -> "dword"
# ReturnedLength : DWORD* optional, out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。