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