Win32 API 日本語リファレンス
ホームNetworking.Clustering › ClusterClearBackupStateForSharedVolume

ClusterClearBackupStateForSharedVolume

関数
共有ボリュームのバックアップ状態を解除する。
DLLRESUTILS.dll呼出規約winapi対応OSwindowsserver2008

シグネチャ

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

DWORD ClusterClearBackupStateForSharedVolume(
    LPCWSTR lpszVolumePathName
);

パラメーター

名前方向説明
lpszVolumePathNameLPCWSTRinバックアップ状態を解除する対象CSVのボリュームパス。

戻り値の型: DWORD

各言語での呼び出し定義

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

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

ClusterClearBackupStateForSharedVolume = ctypes.windll.resutils.ClusterClearBackupStateForSharedVolume
ClusterClearBackupStateForSharedVolume.restype = wintypes.DWORD
ClusterClearBackupStateForSharedVolume.argtypes = [
    wintypes.LPCWSTR,  # lpszVolumePathName : LPCWSTR
]
require 'fiddle'
require 'fiddle/import'

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

var (
	resutils = windows.NewLazySystemDLL("RESUTILS.dll")
	procClusterClearBackupStateForSharedVolume = resutils.NewProc("ClusterClearBackupStateForSharedVolume")
)

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

extern "resutils" fn ClusterClearBackupStateForSharedVolume(
    lpszVolumePathName: [*c]const u16 // LPCWSTR
) callconv(std.os.windows.WINAPI) u32;
proc ClusterClearBackupStateForSharedVolume(
    lpszVolumePathName: WideCString  # LPCWSTR
): uint32 {.importc: "ClusterClearBackupStateForSharedVolume", stdcall, dynlib: "RESUTILS.dll".}
pragma(lib, "resutils");
extern(Windows)
uint ClusterClearBackupStateForSharedVolume(
    const(wchar)* lpszVolumePathName   // LPCWSTR
);
ccall((:ClusterClearBackupStateForSharedVolume, "RESUTILS.dll"), stdcall, UInt32,
      (Cwstring,),
      lpszVolumePathName)
# lpszVolumePathName : LPCWSTR -> Cwstring
# stdcall は 32bit のみ意味を持つ(x64 では無視)。
local ffi = require("ffi")
ffi.cdef[[
uint32_t ClusterClearBackupStateForSharedVolume(
    const uint16_t* lpszVolumePathName);
]]
local resutils = ffi.load("resutils")
-- resutils.ClusterClearBackupStateForSharedVolume(lpszVolumePathName)
-- lpszVolumePathName : LPCWSTR
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
const koffi = require('koffi');
const lib = koffi.load('RESUTILS.dll');
const ClusterClearBackupStateForSharedVolume = lib.func('__stdcall', 'ClusterClearBackupStateForSharedVolume', 'uint32_t', ['str16']);
// ClusterClearBackupStateForSharedVolume(lpszVolumePathName)
// lpszVolumePathName : LPCWSTR -> 'str16'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
const lib = Deno.dlopen("RESUTILS.dll", {
  ClusterClearBackupStateForSharedVolume: { parameters: ["buffer"], result: "u32" },
});
// lib.symbols.ClusterClearBackupStateForSharedVolume(lpszVolumePathName)
// lpszVolumePathName : LPCWSTR -> "buffer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。
<?php
$ffi = FFI::cdef(<<<C
uint32_t ClusterClearBackupStateForSharedVolume(
    const uint16_t* lpszVolumePathName);
C, "RESUTILS.dll");
// $ffi->ClusterClearBackupStateForSharedVolume(lpszVolumePathName);
// lpszVolumePathName : LPCWSTR
// 構造体/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 Resutils extends StdCallLibrary {
    Resutils INSTANCE = Native.load("resutils", Resutils.class);
    int ClusterClearBackupStateForSharedVolume(
        WString lpszVolumePathName   // LPCWSTR
    );
}
@[Link("resutils")]
lib LibRESUTILS
  fun ClusterClearBackupStateForSharedVolume = ClusterClearBackupStateForSharedVolume(
    lpszVolumePathName : UInt16*   # LPCWSTR
  ) : UInt32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。
import 'dart:ffi';
import 'package:ffi/ffi.dart';

typedef ClusterClearBackupStateForSharedVolumeNative = Uint32 Function(Pointer<Utf16>);
typedef ClusterClearBackupStateForSharedVolumeDart = int Function(Pointer<Utf16>);
final ClusterClearBackupStateForSharedVolume = DynamicLibrary.open('RESUTILS.dll')
    .lookupFunction<ClusterClearBackupStateForSharedVolumeNative, ClusterClearBackupStateForSharedVolumeDart>('ClusterClearBackupStateForSharedVolume');
// lpszVolumePathName : LPCWSTR -> Pointer<Utf16>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
function ClusterClearBackupStateForSharedVolume(
  lpszVolumePathName: PWideChar   // LPCWSTR
): DWORD; stdcall;
  external 'RESUTILS.dll' name 'ClusterClearBackupStateForSharedVolume';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import stdcall safe "ClusterClearBackupStateForSharedVolume"
  c_ClusterClearBackupStateForSharedVolume :: CWString -> IO Word32
-- lpszVolumePathName : LPCWSTR -> CWString
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let clusterclearbackupstateforsharedvolume =
  foreign "ClusterClearBackupStateForSharedVolume"
    ((ptr uint16_t) @-> returning uint32_t)
(* lpszVolumePathName : LPCWSTR -> (ptr uint16_t) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)
(cffi:define-foreign-library resutils (t "RESUTILS.dll"))
(cffi:use-foreign-library resutils)

(cffi:defcfun ("ClusterClearBackupStateForSharedVolume" cluster-clear-backup-state-for-shared-volume :convention :stdcall) :uint32
  (lpsz-volume-path-name (:string :encoding :utf-16le)))   ; LPCWSTR
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $ClusterClearBackupStateForSharedVolume = Win32::API::More->new('RESUTILS',
    'DWORD ClusterClearBackupStateForSharedVolume(LPCWSTR lpszVolumePathName)');
# my $ret = $ClusterClearBackupStateForSharedVolume->Call($lpszVolumePathName);
# lpszVolumePathName : LPCWSTR -> LPCWSTR
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。