Win32 API 日本語リファレンス
ホームSecurity › GetSecurityDescriptorRMControl

GetSecurityDescriptorRMControl

関数
セキュリティ記述子のリソースマネージャー制御バイトを取得する。
DLLADVAPI32.dll呼出規約winapi対応OSWindows XP 以降

シグネチャ

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

DWORD GetSecurityDescriptorRMControl(
    PSECURITY_DESCRIPTOR SecurityDescriptor,
    BYTE* RMControl
);

パラメーター

名前方向
SecurityDescriptorPSECURITY_DESCRIPTORin
RMControlBYTE*out

戻り値の型: DWORD

各言語での呼び出し定義

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

DWORD GetSecurityDescriptorRMControl(
    PSECURITY_DESCRIPTOR SecurityDescriptor,
    BYTE* RMControl
);
[DllImport("ADVAPI32.dll", ExactSpelling = true)]
static extern uint GetSecurityDescriptorRMControl(
    IntPtr SecurityDescriptor,   // PSECURITY_DESCRIPTOR
    IntPtr RMControl   // BYTE* out
);
<DllImport("ADVAPI32.dll", ExactSpelling:=True)>
Public Shared Function GetSecurityDescriptorRMControl(
    SecurityDescriptor As IntPtr,   ' PSECURITY_DESCRIPTOR
    RMControl As IntPtr   ' BYTE* out
) As UInteger
End Function
' SecurityDescriptor : PSECURITY_DESCRIPTOR
' RMControl : BYTE* out
Declare PtrSafe Function GetSecurityDescriptorRMControl Lib "advapi32" ( _
    ByVal SecurityDescriptor As LongPtr, _
    ByVal RMControl As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

GetSecurityDescriptorRMControl = ctypes.windll.advapi32.GetSecurityDescriptorRMControl
GetSecurityDescriptorRMControl.restype = wintypes.DWORD
GetSecurityDescriptorRMControl.argtypes = [
    wintypes.HANDLE,  # SecurityDescriptor : PSECURITY_DESCRIPTOR
    ctypes.POINTER(ctypes.c_ubyte),  # RMControl : BYTE* out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('ADVAPI32.dll')
GetSecurityDescriptorRMControl = Fiddle::Function.new(
  lib['GetSecurityDescriptorRMControl'],
  [
    Fiddle::TYPE_VOIDP,  # SecurityDescriptor : PSECURITY_DESCRIPTOR
    Fiddle::TYPE_VOIDP,  # RMControl : BYTE* out
  ],
  -Fiddle::TYPE_INT)
#[link(name = "advapi32")]
extern "system" {
    fn GetSecurityDescriptorRMControl(
        SecurityDescriptor: *mut core::ffi::c_void,  // PSECURITY_DESCRIPTOR
        RMControl: *mut u8  // BYTE* out
    ) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("ADVAPI32.dll")]
public static extern uint GetSecurityDescriptorRMControl(IntPtr SecurityDescriptor, IntPtr RMControl);
"@
$api = Add-Type -MemberDefinition $sig -Name 'ADVAPI32_GetSecurityDescriptorRMControl' -Namespace Win32 -PassThru
# $api::GetSecurityDescriptorRMControl(SecurityDescriptor, RMControl)
#uselib "ADVAPI32.dll"
#func global GetSecurityDescriptorRMControl "GetSecurityDescriptorRMControl" sptr, sptr
; GetSecurityDescriptorRMControl SecurityDescriptor, varptr(RMControl)   ; 戻り値は stat
; SecurityDescriptor : PSECURITY_DESCRIPTOR -> "sptr"
; RMControl : BYTE* out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "ADVAPI32.dll"
#cfunc global GetSecurityDescriptorRMControl "GetSecurityDescriptorRMControl" sptr, var
; res = GetSecurityDescriptorRMControl(SecurityDescriptor, RMControl)
; SecurityDescriptor : PSECURITY_DESCRIPTOR -> "sptr"
; RMControl : BYTE* out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; DWORD GetSecurityDescriptorRMControl(PSECURITY_DESCRIPTOR SecurityDescriptor, BYTE* RMControl)
#uselib "ADVAPI32.dll"
#cfunc global GetSecurityDescriptorRMControl "GetSecurityDescriptorRMControl" intptr, var
; res = GetSecurityDescriptorRMControl(SecurityDescriptor, RMControl)
; SecurityDescriptor : PSECURITY_DESCRIPTOR -> "intptr"
; RMControl : BYTE* out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	advapi32 = windows.NewLazySystemDLL("ADVAPI32.dll")
	procGetSecurityDescriptorRMControl = advapi32.NewProc("GetSecurityDescriptorRMControl")
)

// SecurityDescriptor (PSECURITY_DESCRIPTOR), RMControl (BYTE* out)
r1, _, err := procGetSecurityDescriptorRMControl.Call(
	uintptr(SecurityDescriptor),
	uintptr(RMControl),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // DWORD
function GetSecurityDescriptorRMControl(
  SecurityDescriptor: THandle;   // PSECURITY_DESCRIPTOR
  RMControl: Pointer   // BYTE* out
): DWORD; stdcall;
  external 'ADVAPI32.dll' name 'GetSecurityDescriptorRMControl';
result := DllCall("ADVAPI32\GetSecurityDescriptorRMControl"
    , "Ptr", SecurityDescriptor   ; PSECURITY_DESCRIPTOR
    , "Ptr", RMControl   ; BYTE* out
    , "UInt")   ; return: DWORD
●GetSecurityDescriptorRMControl(SecurityDescriptor, RMControl) = DLL("ADVAPI32.dll", "dword GetSecurityDescriptorRMControl(void*, void*)")
# 呼び出し: GetSecurityDescriptorRMControl(SecurityDescriptor, RMControl)
# SecurityDescriptor : PSECURITY_DESCRIPTOR -> "void*"
# RMControl : BYTE* out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。