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

RemoveClusterNameAccount

関数
クラスタ名アカウントとコンピュータオブジェクトを削除する。
DLLCLUSAPI.dll呼出規約winapi

シグネチャ

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

DWORD RemoveClusterNameAccount(
    HCLUSTER hCluster,
    BOOL bDeleteComputerObjects
);

パラメーター

名前方向説明
hClusterHCLUSTERin名前アカウントを削除する対象クラスターのハンドル。
bDeleteComputerObjectsBOOLinTRUEでActive Directory上のコンピューターオブジェクトも削除する。

戻り値の型: DWORD

各言語での呼び出し定義

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

DWORD RemoveClusterNameAccount(
    HCLUSTER hCluster,
    BOOL bDeleteComputerObjects
);
[DllImport("CLUSAPI.dll", ExactSpelling = true)]
static extern uint RemoveClusterNameAccount(
    IntPtr hCluster,   // HCLUSTER
    bool bDeleteComputerObjects   // BOOL
);
<DllImport("CLUSAPI.dll", ExactSpelling:=True)>
Public Shared Function RemoveClusterNameAccount(
    hCluster As IntPtr,   ' HCLUSTER
    bDeleteComputerObjects As Boolean   ' BOOL
) As UInteger
End Function
' hCluster : HCLUSTER
' bDeleteComputerObjects : BOOL
Declare PtrSafe Function RemoveClusterNameAccount Lib "clusapi" ( _
    ByVal hCluster As LongPtr, _
    ByVal bDeleteComputerObjects As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

RemoveClusterNameAccount = ctypes.windll.clusapi.RemoveClusterNameAccount
RemoveClusterNameAccount.restype = wintypes.DWORD
RemoveClusterNameAccount.argtypes = [
    ctypes.c_ssize_t,  # hCluster : HCLUSTER
    wintypes.BOOL,  # bDeleteComputerObjects : BOOL
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('CLUSAPI.dll')
RemoveClusterNameAccount = Fiddle::Function.new(
  lib['RemoveClusterNameAccount'],
  [
    Fiddle::TYPE_INTPTR_T,  # hCluster : HCLUSTER
    Fiddle::TYPE_INT,  # bDeleteComputerObjects : BOOL
  ],
  -Fiddle::TYPE_INT)
#[link(name = "clusapi")]
extern "system" {
    fn RemoveClusterNameAccount(
        hCluster: isize,  // HCLUSTER
        bDeleteComputerObjects: i32  // BOOL
    ) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("CLUSAPI.dll")]
public static extern uint RemoveClusterNameAccount(IntPtr hCluster, bool bDeleteComputerObjects);
"@
$api = Add-Type -MemberDefinition $sig -Name 'CLUSAPI_RemoveClusterNameAccount' -Namespace Win32 -PassThru
# $api::RemoveClusterNameAccount(hCluster, bDeleteComputerObjects)
#uselib "CLUSAPI.dll"
#func global RemoveClusterNameAccount "RemoveClusterNameAccount" sptr, sptr
; RemoveClusterNameAccount hCluster, bDeleteComputerObjects   ; 戻り値は stat
; hCluster : HCLUSTER -> "sptr"
; bDeleteComputerObjects : BOOL -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "CLUSAPI.dll"
#cfunc global RemoveClusterNameAccount "RemoveClusterNameAccount" sptr, int
; res = RemoveClusterNameAccount(hCluster, bDeleteComputerObjects)
; hCluster : HCLUSTER -> "sptr"
; bDeleteComputerObjects : BOOL -> "int"
; DWORD RemoveClusterNameAccount(HCLUSTER hCluster, BOOL bDeleteComputerObjects)
#uselib "CLUSAPI.dll"
#cfunc global RemoveClusterNameAccount "RemoveClusterNameAccount" intptr, int
; res = RemoveClusterNameAccount(hCluster, bDeleteComputerObjects)
; hCluster : HCLUSTER -> "intptr"
; bDeleteComputerObjects : BOOL -> "int"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	clusapi = windows.NewLazySystemDLL("CLUSAPI.dll")
	procRemoveClusterNameAccount = clusapi.NewProc("RemoveClusterNameAccount")
)

// hCluster (HCLUSTER), bDeleteComputerObjects (BOOL)
r1, _, err := procRemoveClusterNameAccount.Call(
	uintptr(hCluster),
	uintptr(bDeleteComputerObjects),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // DWORD
function RemoveClusterNameAccount(
  hCluster: NativeInt;   // HCLUSTER
  bDeleteComputerObjects: BOOL   // BOOL
): DWORD; stdcall;
  external 'CLUSAPI.dll' name 'RemoveClusterNameAccount';
result := DllCall("CLUSAPI\RemoveClusterNameAccount"
    , "Ptr", hCluster   ; HCLUSTER
    , "Int", bDeleteComputerObjects   ; BOOL
    , "UInt")   ; return: DWORD
●RemoveClusterNameAccount(hCluster, bDeleteComputerObjects) = DLL("CLUSAPI.dll", "dword RemoveClusterNameAccount(int, bool)")
# 呼び出し: RemoveClusterNameAccount(hCluster, bDeleteComputerObjects)
# hCluster : HCLUSTER -> "int"
# bDeleteComputerObjects : BOOL -> "bool"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
const std = @import("std");

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

typedef RemoveClusterNameAccountNative = Uint32 Function(IntPtr, Int32);
typedef RemoveClusterNameAccountDart = int Function(int, int);
final RemoveClusterNameAccount = DynamicLibrary.open('CLUSAPI.dll')
    .lookupFunction<RemoveClusterNameAccountNative, RemoveClusterNameAccountDart>('RemoveClusterNameAccount');
// hCluster : HCLUSTER -> IntPtr
// bDeleteComputerObjects : BOOL -> Int32
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
function RemoveClusterNameAccount(
  hCluster: NativeInt;   // HCLUSTER
  bDeleteComputerObjects: BOOL   // BOOL
): DWORD; stdcall;
  external 'CLUSAPI.dll' name 'RemoveClusterNameAccount';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import stdcall safe "RemoveClusterNameAccount"
  c_RemoveClusterNameAccount :: CIntPtr -> CInt -> IO Word32
-- hCluster : HCLUSTER -> CIntPtr
-- bDeleteComputerObjects : BOOL -> CInt
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let removeclusternameaccount =
  foreign "RemoveClusterNameAccount"
    (intptr_t @-> int32_t @-> returning uint32_t)
(* hCluster : HCLUSTER -> intptr_t *)
(* bDeleteComputerObjects : BOOL -> int32_t *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)
(cffi:define-foreign-library clusapi (t "CLUSAPI.dll"))
(cffi:use-foreign-library clusapi)

(cffi:defcfun ("RemoveClusterNameAccount" remove-cluster-name-account :convention :stdcall) :uint32
  (h-cluster :int64)   ; HCLUSTER
  (b-delete-computer-objects :int32))   ; BOOL
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $RemoveClusterNameAccount = Win32::API::More->new('CLUSAPI',
    'DWORD RemoveClusterNameAccount(LPARAM hCluster, BOOL bDeleteComputerObjects)');
# my $ret = $RemoveClusterNameAccount->Call($hCluster, $bDeleteComputerObjects);
# hCluster : HCLUSTER -> LPARAM
# bDeleteComputerObjects : BOOL -> BOOL
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。