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