ホーム › Security.Cryptography.Sip › CryptSIPRemoveSignedDataMsg
CryptSIPRemoveSignedDataMsg
関数件名から指定の署名済みデータメッセージを削除する。
シグネチャ
// WINTRUST.dll
#include <windows.h>
BOOL CryptSIPRemoveSignedDataMsg(
SIP_SUBJECTINFO* pSubjectInfo,
DWORD dwIndex
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| pSubjectInfo | SIP_SUBJECTINFO* | inout | 対象を記述するSIP_SUBJECTINFO構造体。 |
| dwIndex | DWORD | in | 削除する署名のインデックス(0起点)。 |
戻り値の型: BOOL
各言語での呼び出し定義
// WINTRUST.dll
#include <windows.h>
BOOL CryptSIPRemoveSignedDataMsg(
SIP_SUBJECTINFO* pSubjectInfo,
DWORD dwIndex
);[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("WINTRUST.dll", SetLastError = true, ExactSpelling = true)]
static extern bool CryptSIPRemoveSignedDataMsg(
IntPtr pSubjectInfo, // SIP_SUBJECTINFO* in/out
uint dwIndex // DWORD
);<DllImport("WINTRUST.dll", SetLastError:=True, ExactSpelling:=True)>
Public Shared Function CryptSIPRemoveSignedDataMsg(
pSubjectInfo As IntPtr, ' SIP_SUBJECTINFO* in/out
dwIndex As UInteger ' DWORD
) As <MarshalAs(UnmanagedType.Bool)> Boolean
End Function' pSubjectInfo : SIP_SUBJECTINFO* in/out
' dwIndex : DWORD
Declare PtrSafe Function CryptSIPRemoveSignedDataMsg Lib "wintrust" ( _
ByVal pSubjectInfo As LongPtr, _
ByVal dwIndex As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
CryptSIPRemoveSignedDataMsg = ctypes.windll.wintrust.CryptSIPRemoveSignedDataMsg
CryptSIPRemoveSignedDataMsg.restype = wintypes.BOOL
CryptSIPRemoveSignedDataMsg.argtypes = [
ctypes.c_void_p, # pSubjectInfo : SIP_SUBJECTINFO* in/out
wintypes.DWORD, # dwIndex : DWORD
]
# GetLastError: use ctypes.GetLastError() (or ctypes.WinDLL(use_last_error=True))require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('WINTRUST.dll')
CryptSIPRemoveSignedDataMsg = Fiddle::Function.new(
lib['CryptSIPRemoveSignedDataMsg'],
[
Fiddle::TYPE_VOIDP, # pSubjectInfo : SIP_SUBJECTINFO* in/out
-Fiddle::TYPE_INT, # dwIndex : DWORD
],
Fiddle::TYPE_INT)#[link(name = "wintrust")]
extern "system" {
fn CryptSIPRemoveSignedDataMsg(
pSubjectInfo: *mut SIP_SUBJECTINFO, // SIP_SUBJECTINFO* in/out
dwIndex: u32 // DWORD
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("WINTRUST.dll", SetLastError = true)]
public static extern bool CryptSIPRemoveSignedDataMsg(IntPtr pSubjectInfo, uint dwIndex);
"@
$api = Add-Type -MemberDefinition $sig -Name 'WINTRUST_CryptSIPRemoveSignedDataMsg' -Namespace Win32 -PassThru
# $api::CryptSIPRemoveSignedDataMsg(pSubjectInfo, dwIndex)#uselib "WINTRUST.dll"
#func global CryptSIPRemoveSignedDataMsg "CryptSIPRemoveSignedDataMsg" sptr, sptr
; CryptSIPRemoveSignedDataMsg varptr(pSubjectInfo), dwIndex ; 戻り値は stat
; pSubjectInfo : SIP_SUBJECTINFO* in/out -> "sptr"
; dwIndex : DWORD -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "WINTRUST.dll" #cfunc global CryptSIPRemoveSignedDataMsg "CryptSIPRemoveSignedDataMsg" var, int ; res = CryptSIPRemoveSignedDataMsg(pSubjectInfo, dwIndex) ; pSubjectInfo : SIP_SUBJECTINFO* in/out -> "var" ; dwIndex : DWORD -> "int" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "WINTRUST.dll" #cfunc global CryptSIPRemoveSignedDataMsg "CryptSIPRemoveSignedDataMsg" sptr, int ; res = CryptSIPRemoveSignedDataMsg(varptr(pSubjectInfo), dwIndex) ; pSubjectInfo : SIP_SUBJECTINFO* in/out -> "sptr" ; dwIndex : DWORD -> "int" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; BOOL CryptSIPRemoveSignedDataMsg(SIP_SUBJECTINFO* pSubjectInfo, DWORD dwIndex) #uselib "WINTRUST.dll" #cfunc global CryptSIPRemoveSignedDataMsg "CryptSIPRemoveSignedDataMsg" var, int ; res = CryptSIPRemoveSignedDataMsg(pSubjectInfo, dwIndex) ; pSubjectInfo : SIP_SUBJECTINFO* in/out -> "var" ; dwIndex : DWORD -> "int" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; BOOL CryptSIPRemoveSignedDataMsg(SIP_SUBJECTINFO* pSubjectInfo, DWORD dwIndex) #uselib "WINTRUST.dll" #cfunc global CryptSIPRemoveSignedDataMsg "CryptSIPRemoveSignedDataMsg" intptr, int ; res = CryptSIPRemoveSignedDataMsg(varptr(pSubjectInfo), dwIndex) ; pSubjectInfo : SIP_SUBJECTINFO* in/out -> "intptr" ; dwIndex : DWORD -> "int" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
wintrust = windows.NewLazySystemDLL("WINTRUST.dll")
procCryptSIPRemoveSignedDataMsg = wintrust.NewProc("CryptSIPRemoveSignedDataMsg")
)
// pSubjectInfo (SIP_SUBJECTINFO* in/out), dwIndex (DWORD)
r1, _, err := procCryptSIPRemoveSignedDataMsg.Call(
uintptr(pSubjectInfo),
uintptr(dwIndex),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // BOOLfunction CryptSIPRemoveSignedDataMsg(
pSubjectInfo: Pointer; // SIP_SUBJECTINFO* in/out
dwIndex: DWORD // DWORD
): BOOL; stdcall;
external 'WINTRUST.dll' name 'CryptSIPRemoveSignedDataMsg';result := DllCall("WINTRUST\CryptSIPRemoveSignedDataMsg"
, "Ptr", pSubjectInfo ; SIP_SUBJECTINFO* in/out
, "UInt", dwIndex ; DWORD
, "Int") ; return: BOOL●CryptSIPRemoveSignedDataMsg(pSubjectInfo, dwIndex) = DLL("WINTRUST.dll", "bool CryptSIPRemoveSignedDataMsg(void*, dword)")
# 呼び出し: CryptSIPRemoveSignedDataMsg(pSubjectInfo, dwIndex)
# pSubjectInfo : SIP_SUBJECTINFO* in/out -> "void*"
# dwIndex : DWORD -> "dword"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。const std = @import("std");
extern "wintrust" fn CryptSIPRemoveSignedDataMsg(
pSubjectInfo: [*c]SIP_SUBJECTINFO, // SIP_SUBJECTINFO* in/out
dwIndex: u32 // DWORD
) callconv(std.os.windows.WINAPI) i32;proc CryptSIPRemoveSignedDataMsg(
pSubjectInfo: ptr SIP_SUBJECTINFO, # SIP_SUBJECTINFO* in/out
dwIndex: uint32 # DWORD
): int32 {.importc: "CryptSIPRemoveSignedDataMsg", stdcall, dynlib: "WINTRUST.dll".}pragma(lib, "wintrust");
extern(Windows)
int CryptSIPRemoveSignedDataMsg(
SIP_SUBJECTINFO* pSubjectInfo, // SIP_SUBJECTINFO* in/out
uint dwIndex // DWORD
);ccall((:CryptSIPRemoveSignedDataMsg, "WINTRUST.dll"), stdcall, Int32,
(Ptr{SIP_SUBJECTINFO}, UInt32),
pSubjectInfo, dwIndex)
# pSubjectInfo : SIP_SUBJECTINFO* in/out -> Ptr{SIP_SUBJECTINFO}
# dwIndex : DWORD -> UInt32
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
int32_t CryptSIPRemoveSignedDataMsg(
void* pSubjectInfo,
uint32_t dwIndex);
]]
local wintrust = ffi.load("wintrust")
-- wintrust.CryptSIPRemoveSignedDataMsg(pSubjectInfo, dwIndex)
-- pSubjectInfo : SIP_SUBJECTINFO* in/out
-- dwIndex : DWORD
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('WINTRUST.dll');
const CryptSIPRemoveSignedDataMsg = lib.func('__stdcall', 'CryptSIPRemoveSignedDataMsg', 'int32_t', ['void *', 'uint32_t']);
// CryptSIPRemoveSignedDataMsg(pSubjectInfo, dwIndex)
// pSubjectInfo : SIP_SUBJECTINFO* in/out -> 'void *'
// dwIndex : DWORD -> 'uint32_t'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("WINTRUST.dll", {
CryptSIPRemoveSignedDataMsg: { parameters: ["pointer", "u32"], result: "i32" },
});
// lib.symbols.CryptSIPRemoveSignedDataMsg(pSubjectInfo, dwIndex)
// pSubjectInfo : SIP_SUBJECTINFO* in/out -> "pointer"
// dwIndex : DWORD -> "u32"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
int32_t CryptSIPRemoveSignedDataMsg(
void* pSubjectInfo,
uint32_t dwIndex);
C, "WINTRUST.dll");
// $ffi->CryptSIPRemoveSignedDataMsg(pSubjectInfo, dwIndex);
// pSubjectInfo : SIP_SUBJECTINFO* in/out
// dwIndex : DWORD
// 構造体/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 Wintrust extends StdCallLibrary {
Wintrust INSTANCE = Native.load("wintrust", Wintrust.class);
boolean CryptSIPRemoveSignedDataMsg(
Pointer pSubjectInfo, // SIP_SUBJECTINFO* in/out
int dwIndex // DWORD
);
}@[Link("wintrust")]
lib LibWINTRUST
fun CryptSIPRemoveSignedDataMsg = CryptSIPRemoveSignedDataMsg(
pSubjectInfo : SIP_SUBJECTINFO*, # SIP_SUBJECTINFO* in/out
dwIndex : UInt32 # DWORD
) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef CryptSIPRemoveSignedDataMsgNative = Int32 Function(Pointer<Void>, Uint32);
typedef CryptSIPRemoveSignedDataMsgDart = int Function(Pointer<Void>, int);
final CryptSIPRemoveSignedDataMsg = DynamicLibrary.open('WINTRUST.dll')
.lookupFunction<CryptSIPRemoveSignedDataMsgNative, CryptSIPRemoveSignedDataMsgDart>('CryptSIPRemoveSignedDataMsg');
// pSubjectInfo : SIP_SUBJECTINFO* in/out -> Pointer<Void>
// dwIndex : DWORD -> Uint32
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function CryptSIPRemoveSignedDataMsg(
pSubjectInfo: Pointer; // SIP_SUBJECTINFO* in/out
dwIndex: DWORD // DWORD
): BOOL; stdcall;
external 'WINTRUST.dll' name 'CryptSIPRemoveSignedDataMsg';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "CryptSIPRemoveSignedDataMsg"
c_CryptSIPRemoveSignedDataMsg :: Ptr () -> Word32 -> IO CInt
-- pSubjectInfo : SIP_SUBJECTINFO* in/out -> Ptr ()
-- dwIndex : DWORD -> Word32
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let cryptsipremovesigneddatamsg =
foreign "CryptSIPRemoveSignedDataMsg"
((ptr void) @-> uint32_t @-> returning int32_t)
(* pSubjectInfo : SIP_SUBJECTINFO* in/out -> (ptr void) *)
(* dwIndex : DWORD -> uint32_t *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library wintrust (t "WINTRUST.dll"))
(cffi:use-foreign-library wintrust)
(cffi:defcfun ("CryptSIPRemoveSignedDataMsg" crypt-sipremove-signed-data-msg :convention :stdcall) :int32
(p-subject-info :pointer) ; SIP_SUBJECTINFO* in/out
(dw-index :uint32)) ; DWORD
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $CryptSIPRemoveSignedDataMsg = Win32::API::More->new('WINTRUST',
'BOOL CryptSIPRemoveSignedDataMsg(LPVOID pSubjectInfo, DWORD dwIndex)');
# my $ret = $CryptSIPRemoveSignedDataMsg->Call($pSubjectInfo, $dwIndex);
# pSubjectInfo : SIP_SUBJECTINFO* in/out -> LPVOID
# dwIndex : DWORD -> DWORD
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。関連項目
使用する型