ホーム › System.Rpc › RpcGetAuthorizationContextForClient
RpcGetAuthorizationContextForClient
関数クライアントの認可コンテキストを取得する。
シグネチャ
// RPCRT4.dll
#include <windows.h>
RPC_STATUS RpcGetAuthorizationContextForClient(
void* ClientBinding, // optional
BOOL ImpersonateOnReturn,
void* Reserved1, // optional
LONGLONG* pExpirationTime, // optional
LUID Reserved2,
DWORD Reserved3,
void* Reserved4, // optional
void** pAuthzClientContext
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| ClientBinding | void* | inoptional |
| ImpersonateOnReturn | BOOL | in |
| Reserved1 | void* | inoptional |
| pExpirationTime | LONGLONG* | inoptional |
| Reserved2 | LUID | in |
| Reserved3 | DWORD | in |
| Reserved4 | void* | inoptional |
| pAuthzClientContext | void** | out |
戻り値の型: RPC_STATUS
各言語での呼び出し定義
// RPCRT4.dll
#include <windows.h>
RPC_STATUS RpcGetAuthorizationContextForClient(
void* ClientBinding, // optional
BOOL ImpersonateOnReturn,
void* Reserved1, // optional
LONGLONG* pExpirationTime, // optional
LUID Reserved2,
DWORD Reserved3,
void* Reserved4, // optional
void** pAuthzClientContext
);[DllImport("RPCRT4.dll", ExactSpelling = true)]
static extern int RpcGetAuthorizationContextForClient(
IntPtr ClientBinding, // void* optional
bool ImpersonateOnReturn, // BOOL
IntPtr Reserved1, // void* optional
IntPtr pExpirationTime, // LONGLONG* optional
LUID Reserved2, // LUID
uint Reserved3, // DWORD
IntPtr Reserved4, // void* optional
IntPtr pAuthzClientContext // void** out
);<DllImport("RPCRT4.dll", ExactSpelling:=True)>
Public Shared Function RpcGetAuthorizationContextForClient(
ClientBinding As IntPtr, ' void* optional
ImpersonateOnReturn As Boolean, ' BOOL
Reserved1 As IntPtr, ' void* optional
pExpirationTime As IntPtr, ' LONGLONG* optional
Reserved2 As LUID, ' LUID
Reserved3 As UInteger, ' DWORD
Reserved4 As IntPtr, ' void* optional
pAuthzClientContext As IntPtr ' void** out
) As Integer
End Function' ClientBinding : void* optional
' ImpersonateOnReturn : BOOL
' Reserved1 : void* optional
' pExpirationTime : LONGLONG* optional
' Reserved2 : LUID
' Reserved3 : DWORD
' Reserved4 : void* optional
' pAuthzClientContext : void** out
Declare PtrSafe Function RpcGetAuthorizationContextForClient Lib "rpcrt4" ( _
ByVal ClientBinding As LongPtr, _
ByVal ImpersonateOnReturn As Long, _
ByVal Reserved1 As LongPtr, _
ByVal pExpirationTime As LongPtr, _
ByVal Reserved2 As LongPtr, _
ByVal Reserved3 As Long, _
ByVal Reserved4 As LongPtr, _
ByVal pAuthzClientContext As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
RpcGetAuthorizationContextForClient = ctypes.windll.rpcrt4.RpcGetAuthorizationContextForClient
RpcGetAuthorizationContextForClient.restype = ctypes.c_int
RpcGetAuthorizationContextForClient.argtypes = [
ctypes.POINTER(None), # ClientBinding : void* optional
wintypes.BOOL, # ImpersonateOnReturn : BOOL
ctypes.POINTER(None), # Reserved1 : void* optional
ctypes.POINTER(ctypes.c_longlong), # pExpirationTime : LONGLONG* optional
LUID, # Reserved2 : LUID
wintypes.DWORD, # Reserved3 : DWORD
ctypes.POINTER(None), # Reserved4 : void* optional
ctypes.c_void_p, # pAuthzClientContext : void** out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('RPCRT4.dll')
RpcGetAuthorizationContextForClient = Fiddle::Function.new(
lib['RpcGetAuthorizationContextForClient'],
[
Fiddle::TYPE_VOIDP, # ClientBinding : void* optional
Fiddle::TYPE_INT, # ImpersonateOnReturn : BOOL
Fiddle::TYPE_VOIDP, # Reserved1 : void* optional
Fiddle::TYPE_VOIDP, # pExpirationTime : LONGLONG* optional
Fiddle::TYPE_VOIDP, # Reserved2 : LUID
-Fiddle::TYPE_INT, # Reserved3 : DWORD
Fiddle::TYPE_VOIDP, # Reserved4 : void* optional
Fiddle::TYPE_VOIDP, # pAuthzClientContext : void** out
],
Fiddle::TYPE_INT)#[link(name = "rpcrt4")]
extern "system" {
fn RpcGetAuthorizationContextForClient(
ClientBinding: *mut (), // void* optional
ImpersonateOnReturn: i32, // BOOL
Reserved1: *mut (), // void* optional
pExpirationTime: *mut i64, // LONGLONG* optional
Reserved2: LUID, // LUID
Reserved3: u32, // DWORD
Reserved4: *mut (), // void* optional
pAuthzClientContext: *mut *mut () // void** out
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("RPCRT4.dll")]
public static extern int RpcGetAuthorizationContextForClient(IntPtr ClientBinding, bool ImpersonateOnReturn, IntPtr Reserved1, IntPtr pExpirationTime, LUID Reserved2, uint Reserved3, IntPtr Reserved4, IntPtr pAuthzClientContext);
"@
$api = Add-Type -MemberDefinition $sig -Name 'RPCRT4_RpcGetAuthorizationContextForClient' -Namespace Win32 -PassThru
# $api::RpcGetAuthorizationContextForClient(ClientBinding, ImpersonateOnReturn, Reserved1, pExpirationTime, Reserved2, Reserved3, Reserved4, pAuthzClientContext)#uselib "RPCRT4.dll"
#func global RpcGetAuthorizationContextForClient "RpcGetAuthorizationContextForClient" sptr, sptr, sptr, sptr, sptr, sptr, sptr, sptr
; RpcGetAuthorizationContextForClient ClientBinding, ImpersonateOnReturn, Reserved1, varptr(pExpirationTime), Reserved2, Reserved3, Reserved4, pAuthzClientContext ; 戻り値は stat
; ClientBinding : void* optional -> "sptr"
; ImpersonateOnReturn : BOOL -> "sptr"
; Reserved1 : void* optional -> "sptr"
; pExpirationTime : LONGLONG* optional -> "sptr"
; Reserved2 : LUID -> "sptr"
; Reserved3 : DWORD -> "sptr"
; Reserved4 : void* optional -> "sptr"
; pAuthzClientContext : void** out -> "sptr"
; ※値渡し構造体は直接渡せません。intにパック、または var で構造体変数を渡してください。
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "RPCRT4.dll" #cfunc global RpcGetAuthorizationContextForClient "RpcGetAuthorizationContextForClient" sptr, int, sptr, var, int, int, sptr, sptr ; res = RpcGetAuthorizationContextForClient(ClientBinding, ImpersonateOnReturn, Reserved1, pExpirationTime, Reserved2, Reserved3, Reserved4, pAuthzClientContext) ; ClientBinding : void* optional -> "sptr" ; ImpersonateOnReturn : BOOL -> "int" ; Reserved1 : void* optional -> "sptr" ; pExpirationTime : LONGLONG* optional -> "var" ; Reserved2 : LUID -> "int" ; Reserved3 : DWORD -> "int" ; Reserved4 : void* optional -> "sptr" ; pAuthzClientContext : void** out -> "sptr" ; ※値渡し構造体は直接渡せません。intにパック、または var で構造体変数を渡してください。 ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "RPCRT4.dll" #cfunc global RpcGetAuthorizationContextForClient "RpcGetAuthorizationContextForClient" sptr, int, sptr, sptr, int, int, sptr, sptr ; res = RpcGetAuthorizationContextForClient(ClientBinding, ImpersonateOnReturn, Reserved1, varptr(pExpirationTime), Reserved2, Reserved3, Reserved4, pAuthzClientContext) ; ClientBinding : void* optional -> "sptr" ; ImpersonateOnReturn : BOOL -> "int" ; Reserved1 : void* optional -> "sptr" ; pExpirationTime : LONGLONG* optional -> "sptr" ; Reserved2 : LUID -> "int" ; Reserved3 : DWORD -> "int" ; Reserved4 : void* optional -> "sptr" ; pAuthzClientContext : void** out -> "sptr" ; ※値渡し構造体は直接渡せません。intにパック、または var で構造体変数を渡してください。 ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; RPC_STATUS RpcGetAuthorizationContextForClient(void* ClientBinding, BOOL ImpersonateOnReturn, void* Reserved1, LONGLONG* pExpirationTime, LUID Reserved2, DWORD Reserved3, void* Reserved4, void** pAuthzClientContext) #uselib "RPCRT4.dll" #cfunc global RpcGetAuthorizationContextForClient "RpcGetAuthorizationContextForClient" intptr, int, intptr, var, int, int, intptr, intptr ; res = RpcGetAuthorizationContextForClient(ClientBinding, ImpersonateOnReturn, Reserved1, pExpirationTime, Reserved2, Reserved3, Reserved4, pAuthzClientContext) ; ClientBinding : void* optional -> "intptr" ; ImpersonateOnReturn : BOOL -> "int" ; Reserved1 : void* optional -> "intptr" ; pExpirationTime : LONGLONG* optional -> "var" ; Reserved2 : LUID -> "int" ; Reserved3 : DWORD -> "int" ; Reserved4 : void* optional -> "intptr" ; pAuthzClientContext : void** out -> "intptr" ; ※値渡し構造体は直接渡せません。intにパック、または var で構造体変数を渡してください。 ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; RPC_STATUS RpcGetAuthorizationContextForClient(void* ClientBinding, BOOL ImpersonateOnReturn, void* Reserved1, LONGLONG* pExpirationTime, LUID Reserved2, DWORD Reserved3, void* Reserved4, void** pAuthzClientContext) #uselib "RPCRT4.dll" #cfunc global RpcGetAuthorizationContextForClient "RpcGetAuthorizationContextForClient" intptr, int, intptr, intptr, int, int, intptr, intptr ; res = RpcGetAuthorizationContextForClient(ClientBinding, ImpersonateOnReturn, Reserved1, varptr(pExpirationTime), Reserved2, Reserved3, Reserved4, pAuthzClientContext) ; ClientBinding : void* optional -> "intptr" ; ImpersonateOnReturn : BOOL -> "int" ; Reserved1 : void* optional -> "intptr" ; pExpirationTime : LONGLONG* optional -> "intptr" ; Reserved2 : LUID -> "int" ; Reserved3 : DWORD -> "int" ; Reserved4 : void* optional -> "intptr" ; pAuthzClientContext : void** out -> "intptr" ; ※値渡し構造体は直接渡せません。intにパック、または var で構造体変数を渡してください。 ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
rpcrt4 = windows.NewLazySystemDLL("RPCRT4.dll")
procRpcGetAuthorizationContextForClient = rpcrt4.NewProc("RpcGetAuthorizationContextForClient")
)
// ClientBinding (void* optional), ImpersonateOnReturn (BOOL), Reserved1 (void* optional), pExpirationTime (LONGLONG* optional), Reserved2 (LUID), Reserved3 (DWORD), Reserved4 (void* optional), pAuthzClientContext (void** out)
r1, _, err := procRpcGetAuthorizationContextForClient.Call(
uintptr(ClientBinding),
uintptr(ImpersonateOnReturn),
uintptr(Reserved1),
uintptr(pExpirationTime),
uintptr(Reserved2),
uintptr(Reserved3),
uintptr(Reserved4),
uintptr(pAuthzClientContext),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // RPC_STATUSfunction RpcGetAuthorizationContextForClient(
ClientBinding: Pointer; // void* optional
ImpersonateOnReturn: BOOL; // BOOL
Reserved1: Pointer; // void* optional
pExpirationTime: Pointer; // LONGLONG* optional
Reserved2: LUID; // LUID
Reserved3: DWORD; // DWORD
Reserved4: Pointer; // void* optional
pAuthzClientContext: Pointer // void** out
): Integer; stdcall;
external 'RPCRT4.dll' name 'RpcGetAuthorizationContextForClient';result := DllCall("RPCRT4\RpcGetAuthorizationContextForClient"
, "Ptr", ClientBinding ; void* optional
, "Int", ImpersonateOnReturn ; BOOL
, "Ptr", Reserved1 ; void* optional
, "Ptr", pExpirationTime ; LONGLONG* optional
, "Ptr", Reserved2 ; LUID
, "UInt", Reserved3 ; DWORD
, "Ptr", Reserved4 ; void* optional
, "Ptr", pAuthzClientContext ; void** out
, "Int") ; return: RPC_STATUS●RpcGetAuthorizationContextForClient(ClientBinding, ImpersonateOnReturn, Reserved1, pExpirationTime, Reserved2, Reserved3, Reserved4, pAuthzClientContext) = DLL("RPCRT4.dll", "int RpcGetAuthorizationContextForClient(void*, bool, void*, void*, void*, dword, void*, void*)")
# 呼び出し: RpcGetAuthorizationContextForClient(ClientBinding, ImpersonateOnReturn, Reserved1, pExpirationTime, Reserved2, Reserved3, Reserved4, pAuthzClientContext)
# ClientBinding : void* optional -> "void*"
# ImpersonateOnReturn : BOOL -> "bool"
# Reserved1 : void* optional -> "void*"
# pExpirationTime : LONGLONG* optional -> "void*"
# Reserved2 : LUID -> "void*"
# Reserved3 : DWORD -> "dword"
# Reserved4 : void* optional -> "void*"
# pAuthzClientContext : void** out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。