ホーム › Networking.Clustering › ClusterSetAccountAccess
ClusterSetAccountAccess
関数クラスタに対するアカウントのアクセス権を設定する。
シグネチャ
// CLUSAPI.dll
#include <windows.h>
DWORD ClusterSetAccountAccess(
HCLUSTER hCluster,
LPCWSTR szAccountSID,
DWORD dwAccess,
DWORD dwControlType
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| hCluster | HCLUSTER | in |
| szAccountSID | LPCWSTR | in |
| dwAccess | DWORD | in |
| dwControlType | DWORD | in |
戻り値の型: DWORD
各言語での呼び出し定義
// CLUSAPI.dll
#include <windows.h>
DWORD ClusterSetAccountAccess(
HCLUSTER hCluster,
LPCWSTR szAccountSID,
DWORD dwAccess,
DWORD dwControlType
);[DllImport("CLUSAPI.dll", ExactSpelling = true)]
static extern uint ClusterSetAccountAccess(
IntPtr hCluster, // HCLUSTER
[MarshalAs(UnmanagedType.LPWStr)] string szAccountSID, // LPCWSTR
uint dwAccess, // DWORD
uint dwControlType // DWORD
);<DllImport("CLUSAPI.dll", ExactSpelling:=True)>
Public Shared Function ClusterSetAccountAccess(
hCluster As IntPtr, ' HCLUSTER
<MarshalAs(UnmanagedType.LPWStr)> szAccountSID As String, ' LPCWSTR
dwAccess As UInteger, ' DWORD
dwControlType As UInteger ' DWORD
) As UInteger
End Function' hCluster : HCLUSTER
' szAccountSID : LPCWSTR
' dwAccess : DWORD
' dwControlType : DWORD
Declare PtrSafe Function ClusterSetAccountAccess Lib "clusapi" ( _
ByVal hCluster As LongPtr, _
ByVal szAccountSID As LongPtr, _
ByVal dwAccess As Long, _
ByVal dwControlType As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
ClusterSetAccountAccess = ctypes.windll.clusapi.ClusterSetAccountAccess
ClusterSetAccountAccess.restype = wintypes.DWORD
ClusterSetAccountAccess.argtypes = [
ctypes.c_ssize_t, # hCluster : HCLUSTER
wintypes.LPCWSTR, # szAccountSID : LPCWSTR
wintypes.DWORD, # dwAccess : DWORD
wintypes.DWORD, # dwControlType : DWORD
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('CLUSAPI.dll')
ClusterSetAccountAccess = Fiddle::Function.new(
lib['ClusterSetAccountAccess'],
[
Fiddle::TYPE_INTPTR_T, # hCluster : HCLUSTER
Fiddle::TYPE_VOIDP, # szAccountSID : LPCWSTR
-Fiddle::TYPE_INT, # dwAccess : DWORD
-Fiddle::TYPE_INT, # dwControlType : DWORD
],
-Fiddle::TYPE_INT)#[link(name = "clusapi")]
extern "system" {
fn ClusterSetAccountAccess(
hCluster: isize, // HCLUSTER
szAccountSID: *const u16, // LPCWSTR
dwAccess: u32, // DWORD
dwControlType: u32 // DWORD
) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("CLUSAPI.dll")]
public static extern uint ClusterSetAccountAccess(IntPtr hCluster, [MarshalAs(UnmanagedType.LPWStr)] string szAccountSID, uint dwAccess, uint dwControlType);
"@
$api = Add-Type -MemberDefinition $sig -Name 'CLUSAPI_ClusterSetAccountAccess' -Namespace Win32 -PassThru
# $api::ClusterSetAccountAccess(hCluster, szAccountSID, dwAccess, dwControlType)#uselib "CLUSAPI.dll"
#func global ClusterSetAccountAccess "ClusterSetAccountAccess" sptr, sptr, sptr, sptr
; ClusterSetAccountAccess hCluster, szAccountSID, dwAccess, dwControlType ; 戻り値は stat
; hCluster : HCLUSTER -> "sptr"
; szAccountSID : LPCWSTR -> "sptr"
; dwAccess : DWORD -> "sptr"
; dwControlType : DWORD -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "CLUSAPI.dll"
#cfunc global ClusterSetAccountAccess "ClusterSetAccountAccess" sptr, wstr, int, int
; res = ClusterSetAccountAccess(hCluster, szAccountSID, dwAccess, dwControlType)
; hCluster : HCLUSTER -> "sptr"
; szAccountSID : LPCWSTR -> "wstr"
; dwAccess : DWORD -> "int"
; dwControlType : DWORD -> "int"; DWORD ClusterSetAccountAccess(HCLUSTER hCluster, LPCWSTR szAccountSID, DWORD dwAccess, DWORD dwControlType)
#uselib "CLUSAPI.dll"
#cfunc global ClusterSetAccountAccess "ClusterSetAccountAccess" intptr, wstr, int, int
; res = ClusterSetAccountAccess(hCluster, szAccountSID, dwAccess, dwControlType)
; hCluster : HCLUSTER -> "intptr"
; szAccountSID : LPCWSTR -> "wstr"
; dwAccess : DWORD -> "int"
; dwControlType : DWORD -> "int"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
clusapi = windows.NewLazySystemDLL("CLUSAPI.dll")
procClusterSetAccountAccess = clusapi.NewProc("ClusterSetAccountAccess")
)
// hCluster (HCLUSTER), szAccountSID (LPCWSTR), dwAccess (DWORD), dwControlType (DWORD)
r1, _, err := procClusterSetAccountAccess.Call(
uintptr(hCluster),
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(szAccountSID))),
uintptr(dwAccess),
uintptr(dwControlType),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // DWORDfunction ClusterSetAccountAccess(
hCluster: NativeInt; // HCLUSTER
szAccountSID: PWideChar; // LPCWSTR
dwAccess: DWORD; // DWORD
dwControlType: DWORD // DWORD
): DWORD; stdcall;
external 'CLUSAPI.dll' name 'ClusterSetAccountAccess';result := DllCall("CLUSAPI\ClusterSetAccountAccess"
, "Ptr", hCluster ; HCLUSTER
, "WStr", szAccountSID ; LPCWSTR
, "UInt", dwAccess ; DWORD
, "UInt", dwControlType ; DWORD
, "UInt") ; return: DWORD●ClusterSetAccountAccess(hCluster, szAccountSID, dwAccess, dwControlType) = DLL("CLUSAPI.dll", "dword ClusterSetAccountAccess(int, char*, dword, dword)")
# 呼び出し: ClusterSetAccountAccess(hCluster, szAccountSID, dwAccess, dwControlType)
# hCluster : HCLUSTER -> "int"
# szAccountSID : LPCWSTR -> "char*"
# dwAccess : DWORD -> "dword"
# dwControlType : DWORD -> "dword"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。