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

CfUnregisterSyncRoot

関数
指定パスの同期ルート登録を解除する。
DLLcldapi.dll呼出規約winapi対応OSWindows 10 以降

シグネチャ

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

HRESULT CfUnregisterSyncRoot(
    LPCWSTR SyncRootPath
);

パラメーター

名前方向
SyncRootPathLPCWSTRin

戻り値の型: HRESULT

各言語での呼び出し定義

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

HRESULT CfUnregisterSyncRoot(
    LPCWSTR SyncRootPath
);
[DllImport("cldapi.dll", ExactSpelling = true)]
static extern int CfUnregisterSyncRoot(
    [MarshalAs(UnmanagedType.LPWStr)] string SyncRootPath   // LPCWSTR
);
<DllImport("cldapi.dll", ExactSpelling:=True)>
Public Shared Function CfUnregisterSyncRoot(
    <MarshalAs(UnmanagedType.LPWStr)> SyncRootPath As String   ' LPCWSTR
) As Integer
End Function
' SyncRootPath : LPCWSTR
Declare PtrSafe Function CfUnregisterSyncRoot Lib "cldapi" ( _
    ByVal SyncRootPath As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

CfUnregisterSyncRoot = ctypes.windll.cldapi.CfUnregisterSyncRoot
CfUnregisterSyncRoot.restype = ctypes.c_int
CfUnregisterSyncRoot.argtypes = [
    wintypes.LPCWSTR,  # SyncRootPath : LPCWSTR
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('cldapi.dll')
CfUnregisterSyncRoot = Fiddle::Function.new(
  lib['CfUnregisterSyncRoot'],
  [
    Fiddle::TYPE_VOIDP,  # SyncRootPath : LPCWSTR
  ],
  Fiddle::TYPE_INT)
#[link(name = "cldapi")]
extern "system" {
    fn CfUnregisterSyncRoot(
        SyncRootPath: *const u16  // LPCWSTR
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("cldapi.dll")]
public static extern int CfUnregisterSyncRoot([MarshalAs(UnmanagedType.LPWStr)] string SyncRootPath);
"@
$api = Add-Type -MemberDefinition $sig -Name 'cldapi_CfUnregisterSyncRoot' -Namespace Win32 -PassThru
# $api::CfUnregisterSyncRoot(SyncRootPath)
#uselib "cldapi.dll"
#func global CfUnregisterSyncRoot "CfUnregisterSyncRoot" sptr
; CfUnregisterSyncRoot SyncRootPath   ; 戻り値は stat
; SyncRootPath : LPCWSTR -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "cldapi.dll"
#cfunc global CfUnregisterSyncRoot "CfUnregisterSyncRoot" wstr
; res = CfUnregisterSyncRoot(SyncRootPath)
; SyncRootPath : LPCWSTR -> "wstr"
; HRESULT CfUnregisterSyncRoot(LPCWSTR SyncRootPath)
#uselib "cldapi.dll"
#cfunc global CfUnregisterSyncRoot "CfUnregisterSyncRoot" wstr
; res = CfUnregisterSyncRoot(SyncRootPath)
; SyncRootPath : LPCWSTR -> "wstr"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	cldapi = windows.NewLazySystemDLL("cldapi.dll")
	procCfUnregisterSyncRoot = cldapi.NewProc("CfUnregisterSyncRoot")
)

// SyncRootPath (LPCWSTR)
r1, _, err := procCfUnregisterSyncRoot.Call(
	uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(SyncRootPath))),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // HRESULT
function CfUnregisterSyncRoot(
  SyncRootPath: PWideChar   // LPCWSTR
): Integer; stdcall;
  external 'cldapi.dll' name 'CfUnregisterSyncRoot';
result := DllCall("cldapi\CfUnregisterSyncRoot"
    , "WStr", SyncRootPath   ; LPCWSTR
    , "Int")   ; return: HRESULT
●CfUnregisterSyncRoot(SyncRootPath) = DLL("cldapi.dll", "int CfUnregisterSyncRoot(char*)")
# 呼び出し: CfUnregisterSyncRoot(SyncRootPath)
# SyncRootPath : LPCWSTR -> "char*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。