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