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

RemoveLogContainer

関数
CLFSログからコンテナを削除する。
DLLclfsw32.dll呼出規約winapiSetLastErrorあり対応OSWindows Vista 以降

シグネチャ

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

BOOL RemoveLogContainer(
    HANDLE hLog,
    LPWSTR pwszContainerPath,
    BOOL fForce,
    void* pReserved   // optional
);

パラメーター

名前方向
hLogHANDLEin
pwszContainerPathLPWSTRin
fForceBOOLin
pReservedvoid*inoutoptional

戻り値の型: BOOL

各言語での呼び出し定義

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

BOOL RemoveLogContainer(
    HANDLE hLog,
    LPWSTR pwszContainerPath,
    BOOL fForce,
    void* pReserved   // optional
);
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("clfsw32.dll", SetLastError = true, ExactSpelling = true)]
static extern bool RemoveLogContainer(
    IntPtr hLog,   // HANDLE
    [MarshalAs(UnmanagedType.LPWStr)] string pwszContainerPath,   // LPWSTR
    bool fForce,   // BOOL
    IntPtr pReserved   // void* optional, in/out
);
<DllImport("clfsw32.dll", SetLastError:=True, ExactSpelling:=True)>
Public Shared Function RemoveLogContainer(
    hLog As IntPtr,   ' HANDLE
    <MarshalAs(UnmanagedType.LPWStr)> pwszContainerPath As String,   ' LPWSTR
    fForce As Boolean,   ' BOOL
    pReserved As IntPtr   ' void* optional, in/out
) As Boolean
End Function
' hLog : HANDLE
' pwszContainerPath : LPWSTR
' fForce : BOOL
' pReserved : void* optional, in/out
Declare PtrSafe Function RemoveLogContainer Lib "clfsw32" ( _
    ByVal hLog As LongPtr, _
    ByVal pwszContainerPath As LongPtr, _
    ByVal fForce As Long, _
    ByVal pReserved As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

RemoveLogContainer = ctypes.windll.clfsw32.RemoveLogContainer
RemoveLogContainer.restype = wintypes.BOOL
RemoveLogContainer.argtypes = [
    wintypes.HANDLE,  # hLog : HANDLE
    wintypes.LPCWSTR,  # pwszContainerPath : LPWSTR
    wintypes.BOOL,  # fForce : BOOL
    ctypes.POINTER(None),  # pReserved : void* optional, in/out
]
# GetLastError: use ctypes.GetLastError() (or ctypes.WinDLL(use_last_error=True))
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('clfsw32.dll')
RemoveLogContainer = Fiddle::Function.new(
  lib['RemoveLogContainer'],
  [
    Fiddle::TYPE_VOIDP,  # hLog : HANDLE
    Fiddle::TYPE_VOIDP,  # pwszContainerPath : LPWSTR
    Fiddle::TYPE_INT,  # fForce : BOOL
    Fiddle::TYPE_VOIDP,  # pReserved : void* optional, in/out
  ],
  Fiddle::TYPE_INT)
#[link(name = "clfsw32")]
extern "system" {
    fn RemoveLogContainer(
        hLog: *mut core::ffi::c_void,  // HANDLE
        pwszContainerPath: *mut u16,  // LPWSTR
        fForce: i32,  // BOOL
        pReserved: *mut ()  // void* optional, in/out
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("clfsw32.dll", SetLastError = true)]
public static extern bool RemoveLogContainer(IntPtr hLog, [MarshalAs(UnmanagedType.LPWStr)] string pwszContainerPath, bool fForce, IntPtr pReserved);
"@
$api = Add-Type -MemberDefinition $sig -Name 'clfsw32_RemoveLogContainer' -Namespace Win32 -PassThru
# $api::RemoveLogContainer(hLog, pwszContainerPath, fForce, pReserved)
#uselib "clfsw32.dll"
#func global RemoveLogContainer "RemoveLogContainer" sptr, sptr, sptr, sptr
; RemoveLogContainer hLog, pwszContainerPath, fForce, pReserved   ; 戻り値は stat
; hLog : HANDLE -> "sptr"
; pwszContainerPath : LPWSTR -> "sptr"
; fForce : BOOL -> "sptr"
; pReserved : void* optional, in/out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "clfsw32.dll"
#cfunc global RemoveLogContainer "RemoveLogContainer" sptr, wstr, int, sptr
; res = RemoveLogContainer(hLog, pwszContainerPath, fForce, pReserved)
; hLog : HANDLE -> "sptr"
; pwszContainerPath : LPWSTR -> "wstr"
; fForce : BOOL -> "int"
; pReserved : void* optional, in/out -> "sptr"
; BOOL RemoveLogContainer(HANDLE hLog, LPWSTR pwszContainerPath, BOOL fForce, void* pReserved)
#uselib "clfsw32.dll"
#cfunc global RemoveLogContainer "RemoveLogContainer" intptr, wstr, int, intptr
; res = RemoveLogContainer(hLog, pwszContainerPath, fForce, pReserved)
; hLog : HANDLE -> "intptr"
; pwszContainerPath : LPWSTR -> "wstr"
; fForce : BOOL -> "int"
; pReserved : void* optional, in/out -> "intptr"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	clfsw32 = windows.NewLazySystemDLL("clfsw32.dll")
	procRemoveLogContainer = clfsw32.NewProc("RemoveLogContainer")
)

// hLog (HANDLE), pwszContainerPath (LPWSTR), fForce (BOOL), pReserved (void* optional, in/out)
r1, _, err := procRemoveLogContainer.Call(
	uintptr(hLog),
	uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(pwszContainerPath))),
	uintptr(fForce),
	uintptr(pReserved),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // BOOL
function RemoveLogContainer(
  hLog: THandle;   // HANDLE
  pwszContainerPath: PWideChar;   // LPWSTR
  fForce: BOOL;   // BOOL
  pReserved: Pointer   // void* optional, in/out
): BOOL; stdcall;
  external 'clfsw32.dll' name 'RemoveLogContainer';
result := DllCall("clfsw32\RemoveLogContainer"
    , "Ptr", hLog   ; HANDLE
    , "WStr", pwszContainerPath   ; LPWSTR
    , "Int", fForce   ; BOOL
    , "Ptr", pReserved   ; void* optional, in/out
    , "Int")   ; return: BOOL
●RemoveLogContainer(hLog, pwszContainerPath, fForce, pReserved) = DLL("clfsw32.dll", "bool RemoveLogContainer(void*, char*, bool, void*)")
# 呼び出し: RemoveLogContainer(hLog, pwszContainerPath, fForce, pReserved)
# hLog : HANDLE -> "void*"
# pwszContainerPath : LPWSTR -> "char*"
# fForce : BOOL -> "bool"
# pReserved : void* optional, in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。