ホーム › Security.EnterpriseData › SrpEnablePermissiveModeFileEncryption
SrpEnablePermissiveModeFileEncryption
関数指定企業IDのファイル暗号化を寛容モードで有効にする。
シグネチャ
// srpapi.dll
#include <windows.h>
HRESULT SrpEnablePermissiveModeFileEncryption(
LPCWSTR enterpriseId // optional
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| enterpriseId | LPCWSTR | inoptional |
戻り値の型: HRESULT
各言語での呼び出し定義
// srpapi.dll
#include <windows.h>
HRESULT SrpEnablePermissiveModeFileEncryption(
LPCWSTR enterpriseId // optional
);[DllImport("srpapi.dll", ExactSpelling = true)]
static extern int SrpEnablePermissiveModeFileEncryption(
[MarshalAs(UnmanagedType.LPWStr)] string enterpriseId // LPCWSTR optional
);<DllImport("srpapi.dll", ExactSpelling:=True)>
Public Shared Function SrpEnablePermissiveModeFileEncryption(
<MarshalAs(UnmanagedType.LPWStr)> enterpriseId As String ' LPCWSTR optional
) As Integer
End Function' enterpriseId : LPCWSTR optional
Declare PtrSafe Function SrpEnablePermissiveModeFileEncryption Lib "srpapi" ( _
ByVal enterpriseId As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
SrpEnablePermissiveModeFileEncryption = ctypes.windll.srpapi.SrpEnablePermissiveModeFileEncryption
SrpEnablePermissiveModeFileEncryption.restype = ctypes.c_int
SrpEnablePermissiveModeFileEncryption.argtypes = [
wintypes.LPCWSTR, # enterpriseId : LPCWSTR optional
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('srpapi.dll')
SrpEnablePermissiveModeFileEncryption = Fiddle::Function.new(
lib['SrpEnablePermissiveModeFileEncryption'],
[
Fiddle::TYPE_VOIDP, # enterpriseId : LPCWSTR optional
],
Fiddle::TYPE_INT)#[link(name = "srpapi")]
extern "system" {
fn SrpEnablePermissiveModeFileEncryption(
enterpriseId: *const u16 // LPCWSTR optional
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("srpapi.dll")]
public static extern int SrpEnablePermissiveModeFileEncryption([MarshalAs(UnmanagedType.LPWStr)] string enterpriseId);
"@
$api = Add-Type -MemberDefinition $sig -Name 'srpapi_SrpEnablePermissiveModeFileEncryption' -Namespace Win32 -PassThru
# $api::SrpEnablePermissiveModeFileEncryption(enterpriseId)#uselib "srpapi.dll"
#func global SrpEnablePermissiveModeFileEncryption "SrpEnablePermissiveModeFileEncryption" sptr
; SrpEnablePermissiveModeFileEncryption enterpriseId ; 戻り値は stat
; enterpriseId : LPCWSTR optional -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "srpapi.dll"
#cfunc global SrpEnablePermissiveModeFileEncryption "SrpEnablePermissiveModeFileEncryption" wstr
; res = SrpEnablePermissiveModeFileEncryption(enterpriseId)
; enterpriseId : LPCWSTR optional -> "wstr"; HRESULT SrpEnablePermissiveModeFileEncryption(LPCWSTR enterpriseId)
#uselib "srpapi.dll"
#cfunc global SrpEnablePermissiveModeFileEncryption "SrpEnablePermissiveModeFileEncryption" wstr
; res = SrpEnablePermissiveModeFileEncryption(enterpriseId)
; enterpriseId : LPCWSTR optional -> "wstr"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
srpapi = windows.NewLazySystemDLL("srpapi.dll")
procSrpEnablePermissiveModeFileEncryption = srpapi.NewProc("SrpEnablePermissiveModeFileEncryption")
)
// enterpriseId (LPCWSTR optional)
r1, _, err := procSrpEnablePermissiveModeFileEncryption.Call(
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(enterpriseId))),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HRESULTfunction SrpEnablePermissiveModeFileEncryption(
enterpriseId: PWideChar // LPCWSTR optional
): Integer; stdcall;
external 'srpapi.dll' name 'SrpEnablePermissiveModeFileEncryption';result := DllCall("srpapi\SrpEnablePermissiveModeFileEncryption"
, "WStr", enterpriseId ; LPCWSTR optional
, "Int") ; return: HRESULT●SrpEnablePermissiveModeFileEncryption(enterpriseId) = DLL("srpapi.dll", "int SrpEnablePermissiveModeFileEncryption(char*)")
# 呼び出し: SrpEnablePermissiveModeFileEncryption(enterpriseId)
# enterpriseId : LPCWSTR optional -> "char*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。