ホーム › Networking.ActiveDirectory › DsMakeSpnA
DsMakeSpnA
関数構成要素からサービスプリンシパル名を生成する(ANSI版)。
シグネチャ
// DSPARSE.dll (ANSI / -A)
#include <windows.h>
DWORD DsMakeSpnA(
LPCSTR ServiceClass,
LPCSTR ServiceName,
LPCSTR InstanceName, // optional
WORD InstancePort,
LPCSTR Referrer, // optional
DWORD* pcSpnLength,
LPSTR pszSpn // optional
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| ServiceClass | LPCSTR | in | サービスのクラスを表すANSI文字列(例: http)。 |
| ServiceName | LPCSTR | in | サービスを提供するホストまたはドメイン名。 |
| InstanceName | LPCSTR | inoptional | サービスインスタンス名。NULLで省略可。 |
| InstancePort | WORD | in | サービスインスタンスのポート番号。0で省略する。 |
| Referrer | LPCSTR | inoptional | 参照元のホスト名。通常NULLでよい。 |
| pcSpnLength | DWORD* | inout | 入力でpszSpnの容量、出力で生成SPNの文字数を受け渡すDWORDへのポインタ。 |
| pszSpn | LPSTR | outoptional | 生成されたSPN文字列を受け取るANSIバッファ。 |
戻り値の型: DWORD
各言語での呼び出し定義
// DSPARSE.dll (ANSI / -A)
#include <windows.h>
DWORD DsMakeSpnA(
LPCSTR ServiceClass,
LPCSTR ServiceName,
LPCSTR InstanceName, // optional
WORD InstancePort,
LPCSTR Referrer, // optional
DWORD* pcSpnLength,
LPSTR pszSpn // optional
);[DllImport("DSPARSE.dll", CharSet = CharSet.Ansi, ExactSpelling = true)]
static extern uint DsMakeSpnA(
[MarshalAs(UnmanagedType.LPStr)] string ServiceClass, // LPCSTR
[MarshalAs(UnmanagedType.LPStr)] string ServiceName, // LPCSTR
[MarshalAs(UnmanagedType.LPStr)] string InstanceName, // LPCSTR optional
ushort InstancePort, // WORD
[MarshalAs(UnmanagedType.LPStr)] string Referrer, // LPCSTR optional
ref uint pcSpnLength, // DWORD* in/out
[MarshalAs(UnmanagedType.LPStr)] System.Text.StringBuilder pszSpn // LPSTR optional, out
);<DllImport("DSPARSE.dll", CharSet:=CharSet.Ansi, ExactSpelling:=True)>
Public Shared Function DsMakeSpnA(
<MarshalAs(UnmanagedType.LPStr)> ServiceClass As String, ' LPCSTR
<MarshalAs(UnmanagedType.LPStr)> ServiceName As String, ' LPCSTR
<MarshalAs(UnmanagedType.LPStr)> InstanceName As String, ' LPCSTR optional
InstancePort As UShort, ' WORD
<MarshalAs(UnmanagedType.LPStr)> Referrer As String, ' LPCSTR optional
ByRef pcSpnLength As UInteger, ' DWORD* in/out
<MarshalAs(UnmanagedType.LPStr)> pszSpn As System.Text.StringBuilder ' LPSTR optional, out
) As UInteger
End Function' ServiceClass : LPCSTR
' ServiceName : LPCSTR
' InstanceName : LPCSTR optional
' InstancePort : WORD
' Referrer : LPCSTR optional
' pcSpnLength : DWORD* in/out
' pszSpn : LPSTR optional, out
Declare PtrSafe Function DsMakeSpnA Lib "dsparse" ( _
ByVal ServiceClass As String, _
ByVal ServiceName As String, _
ByVal InstanceName As String, _
ByVal InstancePort As Integer, _
ByVal Referrer As String, _
ByRef pcSpnLength As Long, _
ByVal pszSpn As String) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
DsMakeSpnA = ctypes.windll.dsparse.DsMakeSpnA
DsMakeSpnA.restype = wintypes.DWORD
DsMakeSpnA.argtypes = [
wintypes.LPCSTR, # ServiceClass : LPCSTR
wintypes.LPCSTR, # ServiceName : LPCSTR
wintypes.LPCSTR, # InstanceName : LPCSTR optional
ctypes.c_ushort, # InstancePort : WORD
wintypes.LPCSTR, # Referrer : LPCSTR optional
ctypes.POINTER(wintypes.DWORD), # pcSpnLength : DWORD* in/out
wintypes.LPSTR, # pszSpn : LPSTR optional, out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('DSPARSE.dll')
DsMakeSpnA = Fiddle::Function.new(
lib['DsMakeSpnA'],
[
Fiddle::TYPE_VOIDP, # ServiceClass : LPCSTR
Fiddle::TYPE_VOIDP, # ServiceName : LPCSTR
Fiddle::TYPE_VOIDP, # InstanceName : LPCSTR optional
-Fiddle::TYPE_SHORT, # InstancePort : WORD
Fiddle::TYPE_VOIDP, # Referrer : LPCSTR optional
Fiddle::TYPE_VOIDP, # pcSpnLength : DWORD* in/out
Fiddle::TYPE_VOIDP, # pszSpn : LPSTR optional, out
],
-Fiddle::TYPE_INT)#[link(name = "dsparse")]
extern "system" {
fn DsMakeSpnA(
ServiceClass: *const u8, // LPCSTR
ServiceName: *const u8, // LPCSTR
InstanceName: *const u8, // LPCSTR optional
InstancePort: u16, // WORD
Referrer: *const u8, // LPCSTR optional
pcSpnLength: *mut u32, // DWORD* in/out
pszSpn: *mut u8 // LPSTR optional, out
) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("DSPARSE.dll", CharSet = CharSet.Ansi)]
public static extern uint DsMakeSpnA([MarshalAs(UnmanagedType.LPStr)] string ServiceClass, [MarshalAs(UnmanagedType.LPStr)] string ServiceName, [MarshalAs(UnmanagedType.LPStr)] string InstanceName, ushort InstancePort, [MarshalAs(UnmanagedType.LPStr)] string Referrer, ref uint pcSpnLength, [MarshalAs(UnmanagedType.LPStr)] System.Text.StringBuilder pszSpn);
"@
$api = Add-Type -MemberDefinition $sig -Name 'DSPARSE_DsMakeSpnA' -Namespace Win32 -PassThru
# $api::DsMakeSpnA(ServiceClass, ServiceName, InstanceName, InstancePort, Referrer, pcSpnLength, pszSpn)#uselib "DSPARSE.dll"
#func global DsMakeSpnA "DsMakeSpnA" sptr, sptr, sptr, sptr, sptr, sptr, sptr
; DsMakeSpnA ServiceClass, ServiceName, InstanceName, InstancePort, Referrer, varptr(pcSpnLength), varptr(pszSpn) ; 戻り値は stat
; ServiceClass : LPCSTR -> "sptr"
; ServiceName : LPCSTR -> "sptr"
; InstanceName : LPCSTR optional -> "sptr"
; InstancePort : WORD -> "sptr"
; Referrer : LPCSTR optional -> "sptr"
; pcSpnLength : DWORD* in/out -> "sptr"
; pszSpn : LPSTR optional, out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "DSPARSE.dll" #cfunc global DsMakeSpnA "DsMakeSpnA" str, str, str, int, str, var, var ; res = DsMakeSpnA(ServiceClass, ServiceName, InstanceName, InstancePort, Referrer, pcSpnLength, pszSpn) ; ServiceClass : LPCSTR -> "str" ; ServiceName : LPCSTR -> "str" ; InstanceName : LPCSTR optional -> "str" ; InstancePort : WORD -> "int" ; Referrer : LPCSTR optional -> "str" ; pcSpnLength : DWORD* in/out -> "var" ; pszSpn : LPSTR optional, out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "DSPARSE.dll" #cfunc global DsMakeSpnA "DsMakeSpnA" str, str, str, int, str, sptr, sptr ; res = DsMakeSpnA(ServiceClass, ServiceName, InstanceName, InstancePort, Referrer, varptr(pcSpnLength), varptr(pszSpn)) ; ServiceClass : LPCSTR -> "str" ; ServiceName : LPCSTR -> "str" ; InstanceName : LPCSTR optional -> "str" ; InstancePort : WORD -> "int" ; Referrer : LPCSTR optional -> "str" ; pcSpnLength : DWORD* in/out -> "sptr" ; pszSpn : LPSTR optional, out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; DWORD DsMakeSpnA(LPCSTR ServiceClass, LPCSTR ServiceName, LPCSTR InstanceName, WORD InstancePort, LPCSTR Referrer, DWORD* pcSpnLength, LPSTR pszSpn) #uselib "DSPARSE.dll" #cfunc global DsMakeSpnA "DsMakeSpnA" str, str, str, int, str, var, var ; res = DsMakeSpnA(ServiceClass, ServiceName, InstanceName, InstancePort, Referrer, pcSpnLength, pszSpn) ; ServiceClass : LPCSTR -> "str" ; ServiceName : LPCSTR -> "str" ; InstanceName : LPCSTR optional -> "str" ; InstancePort : WORD -> "int" ; Referrer : LPCSTR optional -> "str" ; pcSpnLength : DWORD* in/out -> "var" ; pszSpn : LPSTR optional, out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; DWORD DsMakeSpnA(LPCSTR ServiceClass, LPCSTR ServiceName, LPCSTR InstanceName, WORD InstancePort, LPCSTR Referrer, DWORD* pcSpnLength, LPSTR pszSpn) #uselib "DSPARSE.dll" #cfunc global DsMakeSpnA "DsMakeSpnA" str, str, str, int, str, intptr, intptr ; res = DsMakeSpnA(ServiceClass, ServiceName, InstanceName, InstancePort, Referrer, varptr(pcSpnLength), varptr(pszSpn)) ; ServiceClass : LPCSTR -> "str" ; ServiceName : LPCSTR -> "str" ; InstanceName : LPCSTR optional -> "str" ; InstancePort : WORD -> "int" ; Referrer : LPCSTR optional -> "str" ; pcSpnLength : DWORD* in/out -> "intptr" ; pszSpn : LPSTR optional, out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
dsparse = windows.NewLazySystemDLL("DSPARSE.dll")
procDsMakeSpnA = dsparse.NewProc("DsMakeSpnA")
)
// ServiceClass (LPCSTR), ServiceName (LPCSTR), InstanceName (LPCSTR optional), InstancePort (WORD), Referrer (LPCSTR optional), pcSpnLength (DWORD* in/out), pszSpn (LPSTR optional, out)
r1, _, err := procDsMakeSpnA.Call(
uintptr(unsafe.Pointer(windows.BytePtrFromString(ServiceClass))),
uintptr(unsafe.Pointer(windows.BytePtrFromString(ServiceName))),
uintptr(unsafe.Pointer(windows.BytePtrFromString(InstanceName))),
uintptr(InstancePort),
uintptr(unsafe.Pointer(windows.BytePtrFromString(Referrer))),
uintptr(pcSpnLength),
uintptr(pszSpn),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // DWORDfunction DsMakeSpnA(
ServiceClass: PAnsiChar; // LPCSTR
ServiceName: PAnsiChar; // LPCSTR
InstanceName: PAnsiChar; // LPCSTR optional
InstancePort: Word; // WORD
Referrer: PAnsiChar; // LPCSTR optional
pcSpnLength: Pointer; // DWORD* in/out
pszSpn: PAnsiChar // LPSTR optional, out
): DWORD; stdcall;
external 'DSPARSE.dll' name 'DsMakeSpnA';result := DllCall("DSPARSE\DsMakeSpnA"
, "AStr", ServiceClass ; LPCSTR
, "AStr", ServiceName ; LPCSTR
, "AStr", InstanceName ; LPCSTR optional
, "UShort", InstancePort ; WORD
, "AStr", Referrer ; LPCSTR optional
, "Ptr", pcSpnLength ; DWORD* in/out
, "Ptr", pszSpn ; LPSTR optional, out
, "UInt") ; return: DWORD●DsMakeSpnA(ServiceClass, ServiceName, InstanceName, InstancePort, Referrer, pcSpnLength, pszSpn) = DLL("DSPARSE.dll", "dword DsMakeSpnA(char*, char*, char*, int, char*, void*, char*)")
# 呼び出し: DsMakeSpnA(ServiceClass, ServiceName, InstanceName, InstancePort, Referrer, pcSpnLength, pszSpn)
# ServiceClass : LPCSTR -> "char*"
# ServiceName : LPCSTR -> "char*"
# InstanceName : LPCSTR optional -> "char*"
# InstancePort : WORD -> "int"
# Referrer : LPCSTR optional -> "char*"
# pcSpnLength : DWORD* in/out -> "void*"
# pszSpn : LPSTR optional, out -> "char*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。const std = @import("std");
extern "dsparse" fn DsMakeSpnA(
ServiceClass: [*c]const u8, // LPCSTR
ServiceName: [*c]const u8, // LPCSTR
InstanceName: [*c]const u8, // LPCSTR optional
InstancePort: u16, // WORD
Referrer: [*c]const u8, // LPCSTR optional
pcSpnLength: [*c]u32, // DWORD* in/out
pszSpn: [*c]u8 // LPSTR optional, out
) callconv(std.os.windows.WINAPI) u32;proc DsMakeSpnA(
ServiceClass: cstring, # LPCSTR
ServiceName: cstring, # LPCSTR
InstanceName: cstring, # LPCSTR optional
InstancePort: uint16, # WORD
Referrer: cstring, # LPCSTR optional
pcSpnLength: ptr uint32, # DWORD* in/out
pszSpn: ptr char # LPSTR optional, out
): uint32 {.importc: "DsMakeSpnA", stdcall, dynlib: "DSPARSE.dll".}pragma(lib, "dsparse");
extern(Windows)
uint DsMakeSpnA(
const(char)* ServiceClass, // LPCSTR
const(char)* ServiceName, // LPCSTR
const(char)* InstanceName, // LPCSTR optional
ushort InstancePort, // WORD
const(char)* Referrer, // LPCSTR optional
uint* pcSpnLength, // DWORD* in/out
char* pszSpn // LPSTR optional, out
);ccall((:DsMakeSpnA, "DSPARSE.dll"), stdcall, UInt32,
(Cstring, Cstring, Cstring, UInt16, Cstring, Ptr{UInt32}, Ptr{UInt8}),
ServiceClass, ServiceName, InstanceName, InstancePort, Referrer, pcSpnLength, pszSpn)
# ServiceClass : LPCSTR -> Cstring
# ServiceName : LPCSTR -> Cstring
# InstanceName : LPCSTR optional -> Cstring
# InstancePort : WORD -> UInt16
# Referrer : LPCSTR optional -> Cstring
# pcSpnLength : DWORD* in/out -> Ptr{UInt32}
# pszSpn : LPSTR optional, out -> Ptr{UInt8}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
uint32_t DsMakeSpnA(
const char* ServiceClass,
const char* ServiceName,
const char* InstanceName,
uint16_t InstancePort,
const char* Referrer,
uint32_t* pcSpnLength,
char* pszSpn);
]]
local dsparse = ffi.load("dsparse")
-- dsparse.DsMakeSpnA(ServiceClass, ServiceName, InstanceName, InstancePort, Referrer, pcSpnLength, pszSpn)
-- ServiceClass : LPCSTR
-- ServiceName : LPCSTR
-- InstanceName : LPCSTR optional
-- InstancePort : WORD
-- Referrer : LPCSTR optional
-- pcSpnLength : DWORD* in/out
-- pszSpn : LPSTR optional, out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('DSPARSE.dll');
const DsMakeSpnA = lib.func('__stdcall', 'DsMakeSpnA', 'uint32_t', ['str', 'str', 'str', 'uint16_t', 'str', 'uint32_t *', 'char *']);
// DsMakeSpnA(ServiceClass, ServiceName, InstanceName, InstancePort, Referrer, pcSpnLength, pszSpn)
// ServiceClass : LPCSTR -> 'str'
// ServiceName : LPCSTR -> 'str'
// InstanceName : LPCSTR optional -> 'str'
// InstancePort : WORD -> 'uint16_t'
// Referrer : LPCSTR optional -> 'str'
// pcSpnLength : DWORD* in/out -> 'uint32_t *'
// pszSpn : LPSTR optional, out -> 'char *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("DSPARSE.dll", {
DsMakeSpnA: { parameters: ["buffer", "buffer", "buffer", "u16", "buffer", "pointer", "buffer"], result: "u32" },
});
// lib.symbols.DsMakeSpnA(ServiceClass, ServiceName, InstanceName, InstancePort, Referrer, pcSpnLength, pszSpn)
// ServiceClass : LPCSTR -> "buffer"
// ServiceName : LPCSTR -> "buffer"
// InstanceName : LPCSTR optional -> "buffer"
// InstancePort : WORD -> "u16"
// Referrer : LPCSTR optional -> "buffer"
// pcSpnLength : DWORD* in/out -> "pointer"
// pszSpn : LPSTR optional, out -> "buffer"
// 文字列は "buffer"。ANSI(-A) は new TextEncoder() で UTF-8/ANSI バイト列(末尾に \x00)を渡す。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
uint32_t DsMakeSpnA(
const char* ServiceClass,
const char* ServiceName,
const char* InstanceName,
uint16_t InstancePort,
const char* Referrer,
uint32_t* pcSpnLength,
char* pszSpn);
C, "DSPARSE.dll");
// $ffi->DsMakeSpnA(ServiceClass, ServiceName, InstanceName, InstancePort, Referrer, pcSpnLength, pszSpn);
// ServiceClass : LPCSTR
// ServiceName : LPCSTR
// InstanceName : LPCSTR optional
// InstancePort : WORD
// Referrer : LPCSTR optional
// pcSpnLength : DWORD* in/out
// pszSpn : LPSTR optional, out
// 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
// WINAPI(stdcall): x64 では呼出規約が統一されるため問題なし。x86 では __stdcall 対応のラッパが必要な場合あり。import com.sun.jna.*;
import com.sun.jna.ptr.*;
import com.sun.jna.win32.StdCallLibrary;
import com.sun.jna.win32.W32APIOptions;
public interface Dsparse extends StdCallLibrary {
Dsparse INSTANCE = Native.load("dsparse", Dsparse.class, W32APIOptions.ASCII_OPTIONS);
int DsMakeSpnA(
String ServiceClass, // LPCSTR
String ServiceName, // LPCSTR
String InstanceName, // LPCSTR optional
short InstancePort, // WORD
String Referrer, // LPCSTR optional
IntByReference pcSpnLength, // DWORD* in/out
byte[] pszSpn // LPSTR optional, out
);
}@[Link("dsparse")]
lib LibDSPARSE
fun DsMakeSpnA = DsMakeSpnA(
ServiceClass : UInt8*, # LPCSTR
ServiceName : UInt8*, # LPCSTR
InstanceName : UInt8*, # LPCSTR optional
InstancePort : UInt16, # WORD
Referrer : UInt8*, # LPCSTR optional
pcSpnLength : UInt32*, # DWORD* in/out
pszSpn : UInt8* # LPSTR optional, out
) : UInt32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef DsMakeSpnANative = Uint32 Function(Pointer<Utf8>, Pointer<Utf8>, Pointer<Utf8>, Uint16, Pointer<Utf8>, Pointer<Uint32>, Pointer<Utf8>);
typedef DsMakeSpnADart = int Function(Pointer<Utf8>, Pointer<Utf8>, Pointer<Utf8>, int, Pointer<Utf8>, Pointer<Uint32>, Pointer<Utf8>);
final DsMakeSpnA = DynamicLibrary.open('DSPARSE.dll')
.lookupFunction<DsMakeSpnANative, DsMakeSpnADart>('DsMakeSpnA');
// ServiceClass : LPCSTR -> Pointer<Utf8>
// ServiceName : LPCSTR -> Pointer<Utf8>
// InstanceName : LPCSTR optional -> Pointer<Utf8>
// InstancePort : WORD -> Uint16
// Referrer : LPCSTR optional -> Pointer<Utf8>
// pcSpnLength : DWORD* in/out -> Pointer<Uint32>
// pszSpn : LPSTR optional, out -> Pointer<Utf8>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function DsMakeSpnA(
ServiceClass: PAnsiChar; // LPCSTR
ServiceName: PAnsiChar; // LPCSTR
InstanceName: PAnsiChar; // LPCSTR optional
InstancePort: Word; // WORD
Referrer: PAnsiChar; // LPCSTR optional
pcSpnLength: Pointer; // DWORD* in/out
pszSpn: PAnsiChar // LPSTR optional, out
): DWORD; stdcall;
external 'DSPARSE.dll' name 'DsMakeSpnA';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "DsMakeSpnA"
c_DsMakeSpnA :: CString -> CString -> CString -> Word16 -> CString -> Ptr Word32 -> CString -> IO Word32
-- ServiceClass : LPCSTR -> CString
-- ServiceName : LPCSTR -> CString
-- InstanceName : LPCSTR optional -> CString
-- InstancePort : WORD -> Word16
-- Referrer : LPCSTR optional -> CString
-- pcSpnLength : DWORD* in/out -> Ptr Word32
-- pszSpn : LPSTR optional, out -> CString
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let dsmakespna =
foreign "DsMakeSpnA"
(string @-> string @-> string @-> uint16_t @-> string @-> (ptr uint32_t) @-> string @-> returning uint32_t)
(* ServiceClass : LPCSTR -> string *)
(* ServiceName : LPCSTR -> string *)
(* InstanceName : LPCSTR optional -> string *)
(* InstancePort : WORD -> uint16_t *)
(* Referrer : LPCSTR optional -> string *)
(* pcSpnLength : DWORD* in/out -> (ptr uint32_t) *)
(* pszSpn : LPSTR optional, out -> string *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library dsparse (t "DSPARSE.dll"))
(cffi:use-foreign-library dsparse)
(cffi:defcfun ("DsMakeSpnA" ds-make-spn-a :convention :stdcall) :uint32
(service-class :string) ; LPCSTR
(service-name :string) ; LPCSTR
(instance-name :string) ; LPCSTR optional
(instance-port :uint16) ; WORD
(referrer :string) ; LPCSTR optional
(pc-spn-length :pointer) ; DWORD* in/out
(psz-spn :pointer)) ; LPSTR optional, out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $DsMakeSpnA = Win32::API::More->new('DSPARSE',
'DWORD DsMakeSpnA(LPCSTR ServiceClass, LPCSTR ServiceName, LPCSTR InstanceName, WORD InstancePort, LPCSTR Referrer, LPVOID pcSpnLength, LPSTR pszSpn)');
# my $ret = $DsMakeSpnA->Call($ServiceClass, $ServiceName, $InstanceName, $InstancePort, $Referrer, $pcSpnLength, $pszSpn);
# ServiceClass : LPCSTR -> LPCSTR
# ServiceName : LPCSTR -> LPCSTR
# InstanceName : LPCSTR optional -> LPCSTR
# InstancePort : WORD -> WORD
# Referrer : LPCSTR optional -> LPCSTR
# pcSpnLength : DWORD* in/out -> LPVOID
# pszSpn : LPSTR optional, out -> LPSTR
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。関連項目
文字セット違い
- f DsMakeSpnW (Unicode版) — 構成要素からサービスプリンシパル名を生成する(Unicode版)。