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