ホーム › System.MessageQueuing › MQGetSecurityContextEx
MQGetSecurityContextEx
関数証明書から拡張セキュリティコンテキストを取得する。
シグネチャ
// mqrt.dll
#include <windows.h>
HRESULT MQGetSecurityContextEx(
void* lpCertBuffer, // optional
DWORD dwCertBufferLength,
HANDLE* phSecurityContext
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| lpCertBuffer | void* | inoptional |
| dwCertBufferLength | DWORD | in |
| phSecurityContext | HANDLE* | out |
戻り値の型: HRESULT
各言語での呼び出し定義
// mqrt.dll
#include <windows.h>
HRESULT MQGetSecurityContextEx(
void* lpCertBuffer, // optional
DWORD dwCertBufferLength,
HANDLE* phSecurityContext
);[DllImport("mqrt.dll", ExactSpelling = true)]
static extern int MQGetSecurityContextEx(
IntPtr lpCertBuffer, // void* optional
uint dwCertBufferLength, // DWORD
IntPtr phSecurityContext // HANDLE* out
);<DllImport("mqrt.dll", ExactSpelling:=True)>
Public Shared Function MQGetSecurityContextEx(
lpCertBuffer As IntPtr, ' void* optional
dwCertBufferLength As UInteger, ' DWORD
phSecurityContext As IntPtr ' HANDLE* out
) As Integer
End Function' lpCertBuffer : void* optional
' dwCertBufferLength : DWORD
' phSecurityContext : HANDLE* out
Declare PtrSafe Function MQGetSecurityContextEx Lib "mqrt" ( _
ByVal lpCertBuffer As LongPtr, _
ByVal dwCertBufferLength As Long, _
ByVal phSecurityContext As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
MQGetSecurityContextEx = ctypes.windll.mqrt.MQGetSecurityContextEx
MQGetSecurityContextEx.restype = ctypes.c_int
MQGetSecurityContextEx.argtypes = [
ctypes.POINTER(None), # lpCertBuffer : void* optional
wintypes.DWORD, # dwCertBufferLength : DWORD
ctypes.c_void_p, # phSecurityContext : HANDLE* out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('mqrt.dll')
MQGetSecurityContextEx = Fiddle::Function.new(
lib['MQGetSecurityContextEx'],
[
Fiddle::TYPE_VOIDP, # lpCertBuffer : void* optional
-Fiddle::TYPE_INT, # dwCertBufferLength : DWORD
Fiddle::TYPE_VOIDP, # phSecurityContext : HANDLE* out
],
Fiddle::TYPE_INT)#[link(name = "mqrt")]
extern "system" {
fn MQGetSecurityContextEx(
lpCertBuffer: *mut (), // void* optional
dwCertBufferLength: u32, // DWORD
phSecurityContext: *mut *mut core::ffi::c_void // HANDLE* out
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("mqrt.dll")]
public static extern int MQGetSecurityContextEx(IntPtr lpCertBuffer, uint dwCertBufferLength, IntPtr phSecurityContext);
"@
$api = Add-Type -MemberDefinition $sig -Name 'mqrt_MQGetSecurityContextEx' -Namespace Win32 -PassThru
# $api::MQGetSecurityContextEx(lpCertBuffer, dwCertBufferLength, phSecurityContext)#uselib "mqrt.dll"
#func global MQGetSecurityContextEx "MQGetSecurityContextEx" sptr, sptr, sptr
; MQGetSecurityContextEx lpCertBuffer, dwCertBufferLength, phSecurityContext ; 戻り値は stat
; lpCertBuffer : void* optional -> "sptr"
; dwCertBufferLength : DWORD -> "sptr"
; phSecurityContext : HANDLE* out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "mqrt.dll"
#cfunc global MQGetSecurityContextEx "MQGetSecurityContextEx" sptr, int, sptr
; res = MQGetSecurityContextEx(lpCertBuffer, dwCertBufferLength, phSecurityContext)
; lpCertBuffer : void* optional -> "sptr"
; dwCertBufferLength : DWORD -> "int"
; phSecurityContext : HANDLE* out -> "sptr"; HRESULT MQGetSecurityContextEx(void* lpCertBuffer, DWORD dwCertBufferLength, HANDLE* phSecurityContext)
#uselib "mqrt.dll"
#cfunc global MQGetSecurityContextEx "MQGetSecurityContextEx" intptr, int, intptr
; res = MQGetSecurityContextEx(lpCertBuffer, dwCertBufferLength, phSecurityContext)
; lpCertBuffer : void* optional -> "intptr"
; dwCertBufferLength : DWORD -> "int"
; phSecurityContext : HANDLE* out -> "intptr"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
mqrt = windows.NewLazySystemDLL("mqrt.dll")
procMQGetSecurityContextEx = mqrt.NewProc("MQGetSecurityContextEx")
)
// lpCertBuffer (void* optional), dwCertBufferLength (DWORD), phSecurityContext (HANDLE* out)
r1, _, err := procMQGetSecurityContextEx.Call(
uintptr(lpCertBuffer),
uintptr(dwCertBufferLength),
uintptr(phSecurityContext),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HRESULTfunction MQGetSecurityContextEx(
lpCertBuffer: Pointer; // void* optional
dwCertBufferLength: DWORD; // DWORD
phSecurityContext: Pointer // HANDLE* out
): Integer; stdcall;
external 'mqrt.dll' name 'MQGetSecurityContextEx';result := DllCall("mqrt\MQGetSecurityContextEx"
, "Ptr", lpCertBuffer ; void* optional
, "UInt", dwCertBufferLength ; DWORD
, "Ptr", phSecurityContext ; HANDLE* out
, "Int") ; return: HRESULT●MQGetSecurityContextEx(lpCertBuffer, dwCertBufferLength, phSecurityContext) = DLL("mqrt.dll", "int MQGetSecurityContextEx(void*, dword, void*)")
# 呼び出し: MQGetSecurityContextEx(lpCertBuffer, dwCertBufferLength, phSecurityContext)
# lpCertBuffer : void* optional -> "void*"
# dwCertBufferLength : DWORD -> "dword"
# phSecurityContext : HANDLE* out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。