ホーム › Security.Authorization › BuildTrusteeWithObjectsAndSidA
BuildTrusteeWithObjectsAndSidA
関数オブジェクトとSIDを指定してTRUSTEE構造体を初期化する。
シグネチャ
// ADVAPI32.dll (ANSI / -A)
#include <windows.h>
void BuildTrusteeWithObjectsAndSidA(
TRUSTEE_A* pTrustee,
OBJECTS_AND_SID* pObjSid, // optional
GUID* pObjectGuid, // optional
GUID* pInheritedObjectGuid, // optional
PSID pSid // optional
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| pTrustee | TRUSTEE_A* | inout |
| pObjSid | OBJECTS_AND_SID* | inoptional |
| pObjectGuid | GUID* | inoptional |
| pInheritedObjectGuid | GUID* | inoptional |
| pSid | PSID | inoptional |
戻り値の型: void
各言語での呼び出し定義
// ADVAPI32.dll (ANSI / -A)
#include <windows.h>
void BuildTrusteeWithObjectsAndSidA(
TRUSTEE_A* pTrustee,
OBJECTS_AND_SID* pObjSid, // optional
GUID* pObjectGuid, // optional
GUID* pInheritedObjectGuid, // optional
PSID pSid // optional
);[DllImport("ADVAPI32.dll", CharSet = CharSet.Ansi, ExactSpelling = true)]
static extern void BuildTrusteeWithObjectsAndSidA(
IntPtr pTrustee, // TRUSTEE_A* in/out
IntPtr pObjSid, // OBJECTS_AND_SID* optional
IntPtr pObjectGuid, // GUID* optional
IntPtr pInheritedObjectGuid, // GUID* optional
IntPtr pSid // PSID optional
);<DllImport("ADVAPI32.dll", CharSet:=CharSet.Ansi, ExactSpelling:=True)>
Public Shared Sub BuildTrusteeWithObjectsAndSidA(
pTrustee As IntPtr, ' TRUSTEE_A* in/out
pObjSid As IntPtr, ' OBJECTS_AND_SID* optional
pObjectGuid As IntPtr, ' GUID* optional
pInheritedObjectGuid As IntPtr, ' GUID* optional
pSid As IntPtr ' PSID optional
)
End Sub' pTrustee : TRUSTEE_A* in/out
' pObjSid : OBJECTS_AND_SID* optional
' pObjectGuid : GUID* optional
' pInheritedObjectGuid : GUID* optional
' pSid : PSID optional
Declare PtrSafe Sub BuildTrusteeWithObjectsAndSidA Lib "advapi32" ( _
ByVal pTrustee As LongPtr, _
ByVal pObjSid As LongPtr, _
ByVal pObjectGuid As LongPtr, _
ByVal pInheritedObjectGuid As LongPtr, _
ByVal pSid As LongPtr)
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
BuildTrusteeWithObjectsAndSidA = ctypes.windll.advapi32.BuildTrusteeWithObjectsAndSidA
BuildTrusteeWithObjectsAndSidA.restype = None
BuildTrusteeWithObjectsAndSidA.argtypes = [
ctypes.c_void_p, # pTrustee : TRUSTEE_A* in/out
ctypes.c_void_p, # pObjSid : OBJECTS_AND_SID* optional
ctypes.c_void_p, # pObjectGuid : GUID* optional
ctypes.c_void_p, # pInheritedObjectGuid : GUID* optional
wintypes.HANDLE, # pSid : PSID optional
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('ADVAPI32.dll')
BuildTrusteeWithObjectsAndSidA = Fiddle::Function.new(
lib['BuildTrusteeWithObjectsAndSidA'],
[
Fiddle::TYPE_VOIDP, # pTrustee : TRUSTEE_A* in/out
Fiddle::TYPE_VOIDP, # pObjSid : OBJECTS_AND_SID* optional
Fiddle::TYPE_VOIDP, # pObjectGuid : GUID* optional
Fiddle::TYPE_VOIDP, # pInheritedObjectGuid : GUID* optional
Fiddle::TYPE_VOIDP, # pSid : PSID optional
],
Fiddle::TYPE_VOID)#[link(name = "advapi32")]
extern "system" {
fn BuildTrusteeWithObjectsAndSidA(
pTrustee: *mut TRUSTEE_A, // TRUSTEE_A* in/out
pObjSid: *mut OBJECTS_AND_SID, // OBJECTS_AND_SID* optional
pObjectGuid: *mut GUID, // GUID* optional
pInheritedObjectGuid: *mut GUID, // GUID* optional
pSid: *mut core::ffi::c_void // PSID optional
);
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("ADVAPI32.dll", CharSet = CharSet.Ansi)]
public static extern void BuildTrusteeWithObjectsAndSidA(IntPtr pTrustee, IntPtr pObjSid, IntPtr pObjectGuid, IntPtr pInheritedObjectGuid, IntPtr pSid);
"@
$api = Add-Type -MemberDefinition $sig -Name 'ADVAPI32_BuildTrusteeWithObjectsAndSidA' -Namespace Win32 -PassThru
# $api::BuildTrusteeWithObjectsAndSidA(pTrustee, pObjSid, pObjectGuid, pInheritedObjectGuid, pSid)#uselib "ADVAPI32.dll"
#func global BuildTrusteeWithObjectsAndSidA "BuildTrusteeWithObjectsAndSidA" sptr, sptr, sptr, sptr, sptr
; BuildTrusteeWithObjectsAndSidA varptr(pTrustee), varptr(pObjSid), varptr(pObjectGuid), varptr(pInheritedObjectGuid), pSid
; pTrustee : TRUSTEE_A* in/out -> "sptr"
; pObjSid : OBJECTS_AND_SID* optional -> "sptr"
; pObjectGuid : GUID* optional -> "sptr"
; pInheritedObjectGuid : GUID* optional -> "sptr"
; pSid : PSID optional -> "sptr"出力引数:
#uselib "ADVAPI32.dll" #func global BuildTrusteeWithObjectsAndSidA "BuildTrusteeWithObjectsAndSidA" var, var, var, var, sptr ; BuildTrusteeWithObjectsAndSidA pTrustee, pObjSid, pObjectGuid, pInheritedObjectGuid, pSid ; pTrustee : TRUSTEE_A* in/out -> "var" ; pObjSid : OBJECTS_AND_SID* optional -> "var" ; pObjectGuid : GUID* optional -> "var" ; pInheritedObjectGuid : GUID* optional -> "var" ; pSid : PSID optional -> "sptr" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "ADVAPI32.dll" #func global BuildTrusteeWithObjectsAndSidA "BuildTrusteeWithObjectsAndSidA" sptr, sptr, sptr, sptr, sptr ; BuildTrusteeWithObjectsAndSidA varptr(pTrustee), varptr(pObjSid), varptr(pObjectGuid), varptr(pInheritedObjectGuid), pSid ; pTrustee : TRUSTEE_A* in/out -> "sptr" ; pObjSid : OBJECTS_AND_SID* optional -> "sptr" ; pObjectGuid : GUID* optional -> "sptr" ; pInheritedObjectGuid : GUID* optional -> "sptr" ; pSid : PSID optional -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; void BuildTrusteeWithObjectsAndSidA(TRUSTEE_A* pTrustee, OBJECTS_AND_SID* pObjSid, GUID* pObjectGuid, GUID* pInheritedObjectGuid, PSID pSid) #uselib "ADVAPI32.dll" #func global BuildTrusteeWithObjectsAndSidA "BuildTrusteeWithObjectsAndSidA" var, var, var, var, intptr ; BuildTrusteeWithObjectsAndSidA pTrustee, pObjSid, pObjectGuid, pInheritedObjectGuid, pSid ; pTrustee : TRUSTEE_A* in/out -> "var" ; pObjSid : OBJECTS_AND_SID* optional -> "var" ; pObjectGuid : GUID* optional -> "var" ; pInheritedObjectGuid : GUID* optional -> "var" ; pSid : PSID optional -> "intptr" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; void BuildTrusteeWithObjectsAndSidA(TRUSTEE_A* pTrustee, OBJECTS_AND_SID* pObjSid, GUID* pObjectGuid, GUID* pInheritedObjectGuid, PSID pSid) #uselib "ADVAPI32.dll" #func global BuildTrusteeWithObjectsAndSidA "BuildTrusteeWithObjectsAndSidA" intptr, intptr, intptr, intptr, intptr ; BuildTrusteeWithObjectsAndSidA varptr(pTrustee), varptr(pObjSid), varptr(pObjectGuid), varptr(pInheritedObjectGuid), pSid ; pTrustee : TRUSTEE_A* in/out -> "intptr" ; pObjSid : OBJECTS_AND_SID* optional -> "intptr" ; pObjectGuid : GUID* optional -> "intptr" ; pInheritedObjectGuid : GUID* optional -> "intptr" ; pSid : PSID optional -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
advapi32 = windows.NewLazySystemDLL("ADVAPI32.dll")
procBuildTrusteeWithObjectsAndSidA = advapi32.NewProc("BuildTrusteeWithObjectsAndSidA")
)
// pTrustee (TRUSTEE_A* in/out), pObjSid (OBJECTS_AND_SID* optional), pObjectGuid (GUID* optional), pInheritedObjectGuid (GUID* optional), pSid (PSID optional)
r1, _, err := procBuildTrusteeWithObjectsAndSidA.Call(
uintptr(pTrustee),
uintptr(pObjSid),
uintptr(pObjectGuid),
uintptr(pInheritedObjectGuid),
uintptr(pSid),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // voidprocedure BuildTrusteeWithObjectsAndSidA(
pTrustee: Pointer; // TRUSTEE_A* in/out
pObjSid: Pointer; // OBJECTS_AND_SID* optional
pObjectGuid: PGUID; // GUID* optional
pInheritedObjectGuid: PGUID; // GUID* optional
pSid: THandle // PSID optional
); stdcall;
external 'ADVAPI32.dll' name 'BuildTrusteeWithObjectsAndSidA';result := DllCall("ADVAPI32\BuildTrusteeWithObjectsAndSidA"
, "Ptr", pTrustee ; TRUSTEE_A* in/out
, "Ptr", pObjSid ; OBJECTS_AND_SID* optional
, "Ptr", pObjectGuid ; GUID* optional
, "Ptr", pInheritedObjectGuid ; GUID* optional
, "Ptr", pSid ; PSID optional
, "Int") ; return: void●BuildTrusteeWithObjectsAndSidA(pTrustee, pObjSid, pObjectGuid, pInheritedObjectGuid, pSid) = DLL("ADVAPI32.dll", "int BuildTrusteeWithObjectsAndSidA(void*, void*, void*, void*, void*)")
# 呼び出し: BuildTrusteeWithObjectsAndSidA(pTrustee, pObjSid, pObjectGuid, pInheritedObjectGuid, pSid)
# pTrustee : TRUSTEE_A* in/out -> "void*"
# pObjSid : OBJECTS_AND_SID* optional -> "void*"
# pObjectGuid : GUID* optional -> "void*"
# pInheritedObjectGuid : GUID* optional -> "void*"
# pSid : PSID optional -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。