ホーム › Security.Cryptography.Sip › CryptSIPRetrieveSubjectGuidForCatalogFile
CryptSIPRetrieveSubjectGuidForCatalogFile
関数カタログファイル用のSIP件名GUIDを取得する。
シグネチャ
// CRYPT32.dll
#include <windows.h>
BOOL CryptSIPRetrieveSubjectGuidForCatalogFile(
LPCWSTR FileName,
HANDLE hFileIn,
GUID* pgSubject
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| FileName | LPCWSTR | in |
| hFileIn | HANDLE | in |
| pgSubject | GUID* | inout |
戻り値の型: BOOL
各言語での呼び出し定義
// CRYPT32.dll
#include <windows.h>
BOOL CryptSIPRetrieveSubjectGuidForCatalogFile(
LPCWSTR FileName,
HANDLE hFileIn,
GUID* pgSubject
);[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("CRYPT32.dll", SetLastError = true, ExactSpelling = true)]
static extern bool CryptSIPRetrieveSubjectGuidForCatalogFile(
[MarshalAs(UnmanagedType.LPWStr)] string FileName, // LPCWSTR
IntPtr hFileIn, // HANDLE
ref Guid pgSubject // GUID* in/out
);<DllImport("CRYPT32.dll", SetLastError:=True, ExactSpelling:=True)>
Public Shared Function CryptSIPRetrieveSubjectGuidForCatalogFile(
<MarshalAs(UnmanagedType.LPWStr)> FileName As String, ' LPCWSTR
hFileIn As IntPtr, ' HANDLE
ByRef pgSubject As Guid ' GUID* in/out
) As Boolean
End Function' FileName : LPCWSTR
' hFileIn : HANDLE
' pgSubject : GUID* in/out
Declare PtrSafe Function CryptSIPRetrieveSubjectGuidForCatalogFile Lib "crypt32" ( _
ByVal FileName As LongPtr, _
ByVal hFileIn As LongPtr, _
ByVal pgSubject As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
CryptSIPRetrieveSubjectGuidForCatalogFile = ctypes.windll.crypt32.CryptSIPRetrieveSubjectGuidForCatalogFile
CryptSIPRetrieveSubjectGuidForCatalogFile.restype = wintypes.BOOL
CryptSIPRetrieveSubjectGuidForCatalogFile.argtypes = [
wintypes.LPCWSTR, # FileName : LPCWSTR
wintypes.HANDLE, # hFileIn : HANDLE
ctypes.c_void_p, # pgSubject : GUID* in/out
]
# GetLastError: use ctypes.GetLastError() (or ctypes.WinDLL(use_last_error=True))require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('CRYPT32.dll')
CryptSIPRetrieveSubjectGuidForCatalogFile = Fiddle::Function.new(
lib['CryptSIPRetrieveSubjectGuidForCatalogFile'],
[
Fiddle::TYPE_VOIDP, # FileName : LPCWSTR
Fiddle::TYPE_VOIDP, # hFileIn : HANDLE
Fiddle::TYPE_VOIDP, # pgSubject : GUID* in/out
],
Fiddle::TYPE_INT)#[link(name = "crypt32")]
extern "system" {
fn CryptSIPRetrieveSubjectGuidForCatalogFile(
FileName: *const u16, // LPCWSTR
hFileIn: *mut core::ffi::c_void, // HANDLE
pgSubject: *mut GUID // GUID* in/out
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("CRYPT32.dll", SetLastError = true)]
public static extern bool CryptSIPRetrieveSubjectGuidForCatalogFile([MarshalAs(UnmanagedType.LPWStr)] string FileName, IntPtr hFileIn, ref Guid pgSubject);
"@
$api = Add-Type -MemberDefinition $sig -Name 'CRYPT32_CryptSIPRetrieveSubjectGuidForCatalogFile' -Namespace Win32 -PassThru
# $api::CryptSIPRetrieveSubjectGuidForCatalogFile(FileName, hFileIn, pgSubject)#uselib "CRYPT32.dll"
#func global CryptSIPRetrieveSubjectGuidForCatalogFile "CryptSIPRetrieveSubjectGuidForCatalogFile" sptr, sptr, sptr
; CryptSIPRetrieveSubjectGuidForCatalogFile FileName, hFileIn, varptr(pgSubject) ; 戻り値は stat
; FileName : LPCWSTR -> "sptr"
; hFileIn : HANDLE -> "sptr"
; pgSubject : GUID* in/out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "CRYPT32.dll" #cfunc global CryptSIPRetrieveSubjectGuidForCatalogFile "CryptSIPRetrieveSubjectGuidForCatalogFile" wstr, sptr, var ; res = CryptSIPRetrieveSubjectGuidForCatalogFile(FileName, hFileIn, pgSubject) ; FileName : LPCWSTR -> "wstr" ; hFileIn : HANDLE -> "sptr" ; pgSubject : GUID* in/out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "CRYPT32.dll" #cfunc global CryptSIPRetrieveSubjectGuidForCatalogFile "CryptSIPRetrieveSubjectGuidForCatalogFile" wstr, sptr, sptr ; res = CryptSIPRetrieveSubjectGuidForCatalogFile(FileName, hFileIn, varptr(pgSubject)) ; FileName : LPCWSTR -> "wstr" ; hFileIn : HANDLE -> "sptr" ; pgSubject : GUID* in/out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; BOOL CryptSIPRetrieveSubjectGuidForCatalogFile(LPCWSTR FileName, HANDLE hFileIn, GUID* pgSubject) #uselib "CRYPT32.dll" #cfunc global CryptSIPRetrieveSubjectGuidForCatalogFile "CryptSIPRetrieveSubjectGuidForCatalogFile" wstr, intptr, var ; res = CryptSIPRetrieveSubjectGuidForCatalogFile(FileName, hFileIn, pgSubject) ; FileName : LPCWSTR -> "wstr" ; hFileIn : HANDLE -> "intptr" ; pgSubject : GUID* in/out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; BOOL CryptSIPRetrieveSubjectGuidForCatalogFile(LPCWSTR FileName, HANDLE hFileIn, GUID* pgSubject) #uselib "CRYPT32.dll" #cfunc global CryptSIPRetrieveSubjectGuidForCatalogFile "CryptSIPRetrieveSubjectGuidForCatalogFile" wstr, intptr, intptr ; res = CryptSIPRetrieveSubjectGuidForCatalogFile(FileName, hFileIn, varptr(pgSubject)) ; FileName : LPCWSTR -> "wstr" ; hFileIn : HANDLE -> "intptr" ; pgSubject : GUID* in/out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
crypt32 = windows.NewLazySystemDLL("CRYPT32.dll")
procCryptSIPRetrieveSubjectGuidForCatalogFile = crypt32.NewProc("CryptSIPRetrieveSubjectGuidForCatalogFile")
)
// FileName (LPCWSTR), hFileIn (HANDLE), pgSubject (GUID* in/out)
r1, _, err := procCryptSIPRetrieveSubjectGuidForCatalogFile.Call(
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(FileName))),
uintptr(hFileIn),
uintptr(pgSubject),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // BOOLfunction CryptSIPRetrieveSubjectGuidForCatalogFile(
FileName: PWideChar; // LPCWSTR
hFileIn: THandle; // HANDLE
pgSubject: PGUID // GUID* in/out
): BOOL; stdcall;
external 'CRYPT32.dll' name 'CryptSIPRetrieveSubjectGuidForCatalogFile';result := DllCall("CRYPT32\CryptSIPRetrieveSubjectGuidForCatalogFile"
, "WStr", FileName ; LPCWSTR
, "Ptr", hFileIn ; HANDLE
, "Ptr", pgSubject ; GUID* in/out
, "Int") ; return: BOOL●CryptSIPRetrieveSubjectGuidForCatalogFile(FileName, hFileIn, pgSubject) = DLL("CRYPT32.dll", "bool CryptSIPRetrieveSubjectGuidForCatalogFile(char*, void*, void*)")
# 呼び出し: CryptSIPRetrieveSubjectGuidForCatalogFile(FileName, hFileIn, pgSubject)
# FileName : LPCWSTR -> "char*"
# hFileIn : HANDLE -> "void*"
# pgSubject : GUID* in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。