ホーム › System.MessageQueuing › MQGetQueueSecurity
MQGetQueueSecurity
関数キューのセキュリティ記述子を取得する。
シグネチャ
// mqrt.dll
#include <windows.h>
HRESULT MQGetQueueSecurity(
LPCWSTR lpwcsFormatName,
DWORD RequestedInformation,
PSECURITY_DESCRIPTOR pSecurityDescriptor,
DWORD nLength,
DWORD* lpnLengthNeeded
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| lpwcsFormatName | LPCWSTR | in |
| RequestedInformation | DWORD | in |
| pSecurityDescriptor | PSECURITY_DESCRIPTOR | out |
| nLength | DWORD | in |
| lpnLengthNeeded | DWORD* | out |
戻り値の型: HRESULT
各言語での呼び出し定義
// mqrt.dll
#include <windows.h>
HRESULT MQGetQueueSecurity(
LPCWSTR lpwcsFormatName,
DWORD RequestedInformation,
PSECURITY_DESCRIPTOR pSecurityDescriptor,
DWORD nLength,
DWORD* lpnLengthNeeded
);[DllImport("mqrt.dll", ExactSpelling = true)]
static extern int MQGetQueueSecurity(
[MarshalAs(UnmanagedType.LPWStr)] string lpwcsFormatName, // LPCWSTR
uint RequestedInformation, // DWORD
IntPtr pSecurityDescriptor, // PSECURITY_DESCRIPTOR out
uint nLength, // DWORD
out uint lpnLengthNeeded // DWORD* out
);<DllImport("mqrt.dll", ExactSpelling:=True)>
Public Shared Function MQGetQueueSecurity(
<MarshalAs(UnmanagedType.LPWStr)> lpwcsFormatName As String, ' LPCWSTR
RequestedInformation As UInteger, ' DWORD
pSecurityDescriptor As IntPtr, ' PSECURITY_DESCRIPTOR out
nLength As UInteger, ' DWORD
<Out> ByRef lpnLengthNeeded As UInteger ' DWORD* out
) As Integer
End Function' lpwcsFormatName : LPCWSTR
' RequestedInformation : DWORD
' pSecurityDescriptor : PSECURITY_DESCRIPTOR out
' nLength : DWORD
' lpnLengthNeeded : DWORD* out
Declare PtrSafe Function MQGetQueueSecurity Lib "mqrt" ( _
ByVal lpwcsFormatName As LongPtr, _
ByVal RequestedInformation As Long, _
ByVal pSecurityDescriptor As LongPtr, _
ByVal nLength As Long, _
ByRef lpnLengthNeeded As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
MQGetQueueSecurity = ctypes.windll.mqrt.MQGetQueueSecurity
MQGetQueueSecurity.restype = ctypes.c_int
MQGetQueueSecurity.argtypes = [
wintypes.LPCWSTR, # lpwcsFormatName : LPCWSTR
wintypes.DWORD, # RequestedInformation : DWORD
wintypes.HANDLE, # pSecurityDescriptor : PSECURITY_DESCRIPTOR out
wintypes.DWORD, # nLength : DWORD
ctypes.POINTER(wintypes.DWORD), # lpnLengthNeeded : DWORD* out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('mqrt.dll')
MQGetQueueSecurity = Fiddle::Function.new(
lib['MQGetQueueSecurity'],
[
Fiddle::TYPE_VOIDP, # lpwcsFormatName : LPCWSTR
-Fiddle::TYPE_INT, # RequestedInformation : DWORD
Fiddle::TYPE_VOIDP, # pSecurityDescriptor : PSECURITY_DESCRIPTOR out
-Fiddle::TYPE_INT, # nLength : DWORD
Fiddle::TYPE_VOIDP, # lpnLengthNeeded : DWORD* out
],
Fiddle::TYPE_INT)#[link(name = "mqrt")]
extern "system" {
fn MQGetQueueSecurity(
lpwcsFormatName: *const u16, // LPCWSTR
RequestedInformation: u32, // DWORD
pSecurityDescriptor: *mut core::ffi::c_void, // PSECURITY_DESCRIPTOR out
nLength: u32, // DWORD
lpnLengthNeeded: *mut u32 // DWORD* out
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("mqrt.dll")]
public static extern int MQGetQueueSecurity([MarshalAs(UnmanagedType.LPWStr)] string lpwcsFormatName, uint RequestedInformation, IntPtr pSecurityDescriptor, uint nLength, out uint lpnLengthNeeded);
"@
$api = Add-Type -MemberDefinition $sig -Name 'mqrt_MQGetQueueSecurity' -Namespace Win32 -PassThru
# $api::MQGetQueueSecurity(lpwcsFormatName, RequestedInformation, pSecurityDescriptor, nLength, lpnLengthNeeded)#uselib "mqrt.dll"
#func global MQGetQueueSecurity "MQGetQueueSecurity" sptr, sptr, sptr, sptr, sptr
; MQGetQueueSecurity lpwcsFormatName, RequestedInformation, pSecurityDescriptor, nLength, varptr(lpnLengthNeeded) ; 戻り値は stat
; lpwcsFormatName : LPCWSTR -> "sptr"
; RequestedInformation : DWORD -> "sptr"
; pSecurityDescriptor : PSECURITY_DESCRIPTOR out -> "sptr"
; nLength : DWORD -> "sptr"
; lpnLengthNeeded : DWORD* out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "mqrt.dll" #cfunc global MQGetQueueSecurity "MQGetQueueSecurity" wstr, int, sptr, int, var ; res = MQGetQueueSecurity(lpwcsFormatName, RequestedInformation, pSecurityDescriptor, nLength, lpnLengthNeeded) ; lpwcsFormatName : LPCWSTR -> "wstr" ; RequestedInformation : DWORD -> "int" ; pSecurityDescriptor : PSECURITY_DESCRIPTOR out -> "sptr" ; nLength : DWORD -> "int" ; lpnLengthNeeded : DWORD* out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "mqrt.dll" #cfunc global MQGetQueueSecurity "MQGetQueueSecurity" wstr, int, sptr, int, sptr ; res = MQGetQueueSecurity(lpwcsFormatName, RequestedInformation, pSecurityDescriptor, nLength, varptr(lpnLengthNeeded)) ; lpwcsFormatName : LPCWSTR -> "wstr" ; RequestedInformation : DWORD -> "int" ; pSecurityDescriptor : PSECURITY_DESCRIPTOR out -> "sptr" ; nLength : DWORD -> "int" ; lpnLengthNeeded : DWORD* out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; HRESULT MQGetQueueSecurity(LPCWSTR lpwcsFormatName, DWORD RequestedInformation, PSECURITY_DESCRIPTOR pSecurityDescriptor, DWORD nLength, DWORD* lpnLengthNeeded) #uselib "mqrt.dll" #cfunc global MQGetQueueSecurity "MQGetQueueSecurity" wstr, int, intptr, int, var ; res = MQGetQueueSecurity(lpwcsFormatName, RequestedInformation, pSecurityDescriptor, nLength, lpnLengthNeeded) ; lpwcsFormatName : LPCWSTR -> "wstr" ; RequestedInformation : DWORD -> "int" ; pSecurityDescriptor : PSECURITY_DESCRIPTOR out -> "intptr" ; nLength : DWORD -> "int" ; lpnLengthNeeded : DWORD* out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; HRESULT MQGetQueueSecurity(LPCWSTR lpwcsFormatName, DWORD RequestedInformation, PSECURITY_DESCRIPTOR pSecurityDescriptor, DWORD nLength, DWORD* lpnLengthNeeded) #uselib "mqrt.dll" #cfunc global MQGetQueueSecurity "MQGetQueueSecurity" wstr, int, intptr, int, intptr ; res = MQGetQueueSecurity(lpwcsFormatName, RequestedInformation, pSecurityDescriptor, nLength, varptr(lpnLengthNeeded)) ; lpwcsFormatName : LPCWSTR -> "wstr" ; RequestedInformation : DWORD -> "int" ; pSecurityDescriptor : PSECURITY_DESCRIPTOR out -> "intptr" ; nLength : DWORD -> "int" ; lpnLengthNeeded : DWORD* out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
mqrt = windows.NewLazySystemDLL("mqrt.dll")
procMQGetQueueSecurity = mqrt.NewProc("MQGetQueueSecurity")
)
// lpwcsFormatName (LPCWSTR), RequestedInformation (DWORD), pSecurityDescriptor (PSECURITY_DESCRIPTOR out), nLength (DWORD), lpnLengthNeeded (DWORD* out)
r1, _, err := procMQGetQueueSecurity.Call(
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(lpwcsFormatName))),
uintptr(RequestedInformation),
uintptr(pSecurityDescriptor),
uintptr(nLength),
uintptr(lpnLengthNeeded),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HRESULTfunction MQGetQueueSecurity(
lpwcsFormatName: PWideChar; // LPCWSTR
RequestedInformation: DWORD; // DWORD
pSecurityDescriptor: THandle; // PSECURITY_DESCRIPTOR out
nLength: DWORD; // DWORD
lpnLengthNeeded: Pointer // DWORD* out
): Integer; stdcall;
external 'mqrt.dll' name 'MQGetQueueSecurity';result := DllCall("mqrt\MQGetQueueSecurity"
, "WStr", lpwcsFormatName ; LPCWSTR
, "UInt", RequestedInformation ; DWORD
, "Ptr", pSecurityDescriptor ; PSECURITY_DESCRIPTOR out
, "UInt", nLength ; DWORD
, "Ptr", lpnLengthNeeded ; DWORD* out
, "Int") ; return: HRESULT●MQGetQueueSecurity(lpwcsFormatName, RequestedInformation, pSecurityDescriptor, nLength, lpnLengthNeeded) = DLL("mqrt.dll", "int MQGetQueueSecurity(char*, dword, void*, dword, void*)")
# 呼び出し: MQGetQueueSecurity(lpwcsFormatName, RequestedInformation, pSecurityDescriptor, nLength, lpnLengthNeeded)
# lpwcsFormatName : LPCWSTR -> "char*"
# RequestedInformation : DWORD -> "dword"
# pSecurityDescriptor : PSECURITY_DESCRIPTOR out -> "void*"
# nLength : DWORD -> "dword"
# lpnLengthNeeded : DWORD* out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。