ホーム › Security.Authentication.Identity › SspiEncryptAuthIdentityEx
SspiEncryptAuthIdentityEx
関数オプション指定で認証情報構造体を暗号化する拡張版である。
シグネチャ
// SspiCli.dll
#include <windows.h>
HRESULT SspiEncryptAuthIdentityEx(
DWORD Options,
void* AuthData
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| Options | DWORD | in | 暗号化動作を制御するオプションフラグ(SEC_WINNT_AUTH_IDENTITY_ENCRYPT_SAME_LOGON等)。 |
| AuthData | void* | inout | 入出力。暗号化する認証ID構造体へのポインタ。その場で暗号化される。 |
戻り値の型: HRESULT
各言語での呼び出し定義
// SspiCli.dll
#include <windows.h>
HRESULT SspiEncryptAuthIdentityEx(
DWORD Options,
void* AuthData
);[DllImport("SspiCli.dll", ExactSpelling = true)]
static extern int SspiEncryptAuthIdentityEx(
uint Options, // DWORD
IntPtr AuthData // void* in/out
);<DllImport("SspiCli.dll", ExactSpelling:=True)>
Public Shared Function SspiEncryptAuthIdentityEx(
Options As UInteger, ' DWORD
AuthData As IntPtr ' void* in/out
) As Integer
End Function' Options : DWORD
' AuthData : void* in/out
Declare PtrSafe Function SspiEncryptAuthIdentityEx Lib "sspicli" ( _
ByVal Options As Long, _
ByVal AuthData As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
SspiEncryptAuthIdentityEx = ctypes.windll.sspicli.SspiEncryptAuthIdentityEx
SspiEncryptAuthIdentityEx.restype = ctypes.c_int
SspiEncryptAuthIdentityEx.argtypes = [
wintypes.DWORD, # Options : DWORD
ctypes.POINTER(None), # AuthData : void* in/out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('SspiCli.dll')
SspiEncryptAuthIdentityEx = Fiddle::Function.new(
lib['SspiEncryptAuthIdentityEx'],
[
-Fiddle::TYPE_INT, # Options : DWORD
Fiddle::TYPE_VOIDP, # AuthData : void* in/out
],
Fiddle::TYPE_INT)#[link(name = "sspicli")]
extern "system" {
fn SspiEncryptAuthIdentityEx(
Options: u32, // DWORD
AuthData: *mut () // void* in/out
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("SspiCli.dll")]
public static extern int SspiEncryptAuthIdentityEx(uint Options, IntPtr AuthData);
"@
$api = Add-Type -MemberDefinition $sig -Name 'SspiCli_SspiEncryptAuthIdentityEx' -Namespace Win32 -PassThru
# $api::SspiEncryptAuthIdentityEx(Options, AuthData)#uselib "SspiCli.dll"
#func global SspiEncryptAuthIdentityEx "SspiEncryptAuthIdentityEx" sptr, sptr
; SspiEncryptAuthIdentityEx Options, AuthData ; 戻り値は stat
; Options : DWORD -> "sptr"
; AuthData : void* in/out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "SspiCli.dll"
#cfunc global SspiEncryptAuthIdentityEx "SspiEncryptAuthIdentityEx" int, sptr
; res = SspiEncryptAuthIdentityEx(Options, AuthData)
; Options : DWORD -> "int"
; AuthData : void* in/out -> "sptr"; HRESULT SspiEncryptAuthIdentityEx(DWORD Options, void* AuthData)
#uselib "SspiCli.dll"
#cfunc global SspiEncryptAuthIdentityEx "SspiEncryptAuthIdentityEx" int, intptr
; res = SspiEncryptAuthIdentityEx(Options, AuthData)
; Options : DWORD -> "int"
; AuthData : void* in/out -> "intptr"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
sspicli = windows.NewLazySystemDLL("SspiCli.dll")
procSspiEncryptAuthIdentityEx = sspicli.NewProc("SspiEncryptAuthIdentityEx")
)
// Options (DWORD), AuthData (void* in/out)
r1, _, err := procSspiEncryptAuthIdentityEx.Call(
uintptr(Options),
uintptr(AuthData),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HRESULTfunction SspiEncryptAuthIdentityEx(
Options: DWORD; // DWORD
AuthData: Pointer // void* in/out
): Integer; stdcall;
external 'SspiCli.dll' name 'SspiEncryptAuthIdentityEx';result := DllCall("SspiCli\SspiEncryptAuthIdentityEx"
, "UInt", Options ; DWORD
, "Ptr", AuthData ; void* in/out
, "Int") ; return: HRESULT●SspiEncryptAuthIdentityEx(Options, AuthData) = DLL("SspiCli.dll", "int SspiEncryptAuthIdentityEx(dword, void*)")
# 呼び出し: SspiEncryptAuthIdentityEx(Options, AuthData)
# Options : DWORD -> "dword"
# AuthData : void* in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。const std = @import("std");
extern "sspicli" fn SspiEncryptAuthIdentityEx(
Options: u32, // DWORD
AuthData: ?*anyopaque // void* in/out
) callconv(std.os.windows.WINAPI) i32;proc SspiEncryptAuthIdentityEx(
Options: uint32, # DWORD
AuthData: pointer # void* in/out
): int32 {.importc: "SspiEncryptAuthIdentityEx", stdcall, dynlib: "SspiCli.dll".}pragma(lib, "sspicli");
extern(Windows)
int SspiEncryptAuthIdentityEx(
uint Options, // DWORD
void* AuthData // void* in/out
);ccall((:SspiEncryptAuthIdentityEx, "SspiCli.dll"), stdcall, Int32,
(UInt32, Ptr{Cvoid}),
Options, AuthData)
# Options : DWORD -> UInt32
# AuthData : void* in/out -> Ptr{Cvoid}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
int32_t SspiEncryptAuthIdentityEx(
uint32_t Options,
void* AuthData);
]]
local sspicli = ffi.load("sspicli")
-- sspicli.SspiEncryptAuthIdentityEx(Options, AuthData)
-- Options : DWORD
-- AuthData : void* in/out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('SspiCli.dll');
const SspiEncryptAuthIdentityEx = lib.func('__stdcall', 'SspiEncryptAuthIdentityEx', 'int32_t', ['uint32_t', 'void *']);
// SspiEncryptAuthIdentityEx(Options, AuthData)
// Options : DWORD -> 'uint32_t'
// AuthData : void* in/out -> 'void *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("SspiCli.dll", {
SspiEncryptAuthIdentityEx: { parameters: ["u32", "pointer"], result: "i32" },
});
// lib.symbols.SspiEncryptAuthIdentityEx(Options, AuthData)
// Options : DWORD -> "u32"
// AuthData : void* in/out -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
int32_t SspiEncryptAuthIdentityEx(
uint32_t Options,
void* AuthData);
C, "SspiCli.dll");
// $ffi->SspiEncryptAuthIdentityEx(Options, AuthData);
// Options : DWORD
// AuthData : void* in/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 Sspicli extends StdCallLibrary {
Sspicli INSTANCE = Native.load("sspicli", Sspicli.class);
int SspiEncryptAuthIdentityEx(
int Options, // DWORD
Pointer AuthData // void* in/out
);
}@[Link("sspicli")]
lib LibSspiCli
fun SspiEncryptAuthIdentityEx = SspiEncryptAuthIdentityEx(
Options : UInt32, # DWORD
AuthData : Void* # void* in/out
) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef SspiEncryptAuthIdentityExNative = Int32 Function(Uint32, Pointer<Void>);
typedef SspiEncryptAuthIdentityExDart = int Function(int, Pointer<Void>);
final SspiEncryptAuthIdentityEx = DynamicLibrary.open('SspiCli.dll')
.lookupFunction<SspiEncryptAuthIdentityExNative, SspiEncryptAuthIdentityExDart>('SspiEncryptAuthIdentityEx');
// Options : DWORD -> Uint32
// AuthData : void* in/out -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function SspiEncryptAuthIdentityEx(
Options: DWORD; // DWORD
AuthData: Pointer // void* in/out
): Integer; stdcall;
external 'SspiCli.dll' name 'SspiEncryptAuthIdentityEx';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "SspiEncryptAuthIdentityEx"
c_SspiEncryptAuthIdentityEx :: Word32 -> Ptr () -> IO Int32
-- Options : DWORD -> Word32
-- AuthData : void* in/out -> Ptr ()
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let sspiencryptauthidentityex =
foreign "SspiEncryptAuthIdentityEx"
(uint32_t @-> (ptr void) @-> returning int32_t)
(* Options : DWORD -> uint32_t *)
(* AuthData : void* in/out -> (ptr void) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library sspicli (t "SspiCli.dll"))
(cffi:use-foreign-library sspicli)
(cffi:defcfun ("SspiEncryptAuthIdentityEx" sspi-encrypt-auth-identity-ex :convention :stdcall) :int32
(options :uint32) ; DWORD
(auth-data :pointer)) ; void* in/out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $SspiEncryptAuthIdentityEx = Win32::API::More->new('SspiCli',
'int SspiEncryptAuthIdentityEx(DWORD Options, LPVOID AuthData)');
# my $ret = $SspiEncryptAuthIdentityEx->Call($Options, $AuthData);
# Options : DWORD -> DWORD
# AuthData : void* in/out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。関連項目
類似 API
- f SspiEncryptAuthIdentity — 認証情報構造体をその場で暗号化する。