ホーム › System.Threading › AddSIDToBoundaryDescriptor
AddSIDToBoundaryDescriptor
関数境界記述子に必要なSIDを追加する。
シグネチャ
// KERNEL32.dll
#include <windows.h>
BOOL AddSIDToBoundaryDescriptor(
HANDLE* BoundaryDescriptor,
PSID RequiredSid
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| BoundaryDescriptor | HANDLE* | inout |
| RequiredSid | PSID | in |
戻り値の型: BOOL
各言語での呼び出し定義
// KERNEL32.dll
#include <windows.h>
BOOL AddSIDToBoundaryDescriptor(
HANDLE* BoundaryDescriptor,
PSID RequiredSid
);[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("KERNEL32.dll", SetLastError = true, ExactSpelling = true)]
static extern bool AddSIDToBoundaryDescriptor(
IntPtr BoundaryDescriptor, // HANDLE* in/out
IntPtr RequiredSid // PSID
);<DllImport("KERNEL32.dll", SetLastError:=True, ExactSpelling:=True)>
Public Shared Function AddSIDToBoundaryDescriptor(
BoundaryDescriptor As IntPtr, ' HANDLE* in/out
RequiredSid As IntPtr ' PSID
) As Boolean
End Function' BoundaryDescriptor : HANDLE* in/out
' RequiredSid : PSID
Declare PtrSafe Function AddSIDToBoundaryDescriptor Lib "kernel32" ( _
ByVal BoundaryDescriptor As LongPtr, _
ByVal RequiredSid As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
AddSIDToBoundaryDescriptor = ctypes.windll.kernel32.AddSIDToBoundaryDescriptor
AddSIDToBoundaryDescriptor.restype = wintypes.BOOL
AddSIDToBoundaryDescriptor.argtypes = [
ctypes.c_void_p, # BoundaryDescriptor : HANDLE* in/out
wintypes.HANDLE, # RequiredSid : PSID
]
# GetLastError: use ctypes.GetLastError() (or ctypes.WinDLL(use_last_error=True))require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('KERNEL32.dll')
AddSIDToBoundaryDescriptor = Fiddle::Function.new(
lib['AddSIDToBoundaryDescriptor'],
[
Fiddle::TYPE_VOIDP, # BoundaryDescriptor : HANDLE* in/out
Fiddle::TYPE_VOIDP, # RequiredSid : PSID
],
Fiddle::TYPE_INT)#[link(name = "kernel32")]
extern "system" {
fn AddSIDToBoundaryDescriptor(
BoundaryDescriptor: *mut *mut core::ffi::c_void, // HANDLE* in/out
RequiredSid: *mut core::ffi::c_void // PSID
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("KERNEL32.dll", SetLastError = true)]
public static extern bool AddSIDToBoundaryDescriptor(IntPtr BoundaryDescriptor, IntPtr RequiredSid);
"@
$api = Add-Type -MemberDefinition $sig -Name 'KERNEL32_AddSIDToBoundaryDescriptor' -Namespace Win32 -PassThru
# $api::AddSIDToBoundaryDescriptor(BoundaryDescriptor, RequiredSid)#uselib "KERNEL32.dll"
#func global AddSIDToBoundaryDescriptor "AddSIDToBoundaryDescriptor" sptr, sptr
; AddSIDToBoundaryDescriptor BoundaryDescriptor, RequiredSid ; 戻り値は stat
; BoundaryDescriptor : HANDLE* in/out -> "sptr"
; RequiredSid : PSID -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "KERNEL32.dll"
#cfunc global AddSIDToBoundaryDescriptor "AddSIDToBoundaryDescriptor" sptr, sptr
; res = AddSIDToBoundaryDescriptor(BoundaryDescriptor, RequiredSid)
; BoundaryDescriptor : HANDLE* in/out -> "sptr"
; RequiredSid : PSID -> "sptr"; BOOL AddSIDToBoundaryDescriptor(HANDLE* BoundaryDescriptor, PSID RequiredSid)
#uselib "KERNEL32.dll"
#cfunc global AddSIDToBoundaryDescriptor "AddSIDToBoundaryDescriptor" intptr, intptr
; res = AddSIDToBoundaryDescriptor(BoundaryDescriptor, RequiredSid)
; BoundaryDescriptor : HANDLE* in/out -> "intptr"
; RequiredSid : PSID -> "intptr"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
kernel32 = windows.NewLazySystemDLL("KERNEL32.dll")
procAddSIDToBoundaryDescriptor = kernel32.NewProc("AddSIDToBoundaryDescriptor")
)
// BoundaryDescriptor (HANDLE* in/out), RequiredSid (PSID)
r1, _, err := procAddSIDToBoundaryDescriptor.Call(
uintptr(BoundaryDescriptor),
uintptr(RequiredSid),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // BOOLfunction AddSIDToBoundaryDescriptor(
BoundaryDescriptor: Pointer; // HANDLE* in/out
RequiredSid: THandle // PSID
): BOOL; stdcall;
external 'KERNEL32.dll' name 'AddSIDToBoundaryDescriptor';result := DllCall("KERNEL32\AddSIDToBoundaryDescriptor"
, "Ptr", BoundaryDescriptor ; HANDLE* in/out
, "Ptr", RequiredSid ; PSID
, "Int") ; return: BOOL●AddSIDToBoundaryDescriptor(BoundaryDescriptor, RequiredSid) = DLL("KERNEL32.dll", "bool AddSIDToBoundaryDescriptor(void*, void*)")
# 呼び出し: AddSIDToBoundaryDescriptor(BoundaryDescriptor, RequiredSid)
# BoundaryDescriptor : HANDLE* in/out -> "void*"
# RequiredSid : PSID -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。