Win32 API 日本語リファレンス
ホームSystem.HostComputeSystem › HcsDetachOverlayFilter

HcsDetachOverlayFilter

関数
ボリュームからオーバーレイフィルターをデタッチする。
DLLcomputestorage.dll呼出規約winapi

シグネチャ

// computestorage.dll
#include <windows.h>

HRESULT HcsDetachOverlayFilter(
    LPCWSTR VolumeMountPoint,
    LPCWSTR LayerData
);

パラメーター

名前方向説明
VolumeMountPointLPCWSTRinオーバーレイフィルタを切り離すボリュームのマウントポイント文字列。
LayerDataLPCWSTRin対象レイヤー構成を記述したJSON形式のレイヤーデータ文字列。

戻り値の型: HRESULT

各言語での呼び出し定義

// computestorage.dll
#include <windows.h>

HRESULT HcsDetachOverlayFilter(
    LPCWSTR VolumeMountPoint,
    LPCWSTR LayerData
);
[DllImport("computestorage.dll", ExactSpelling = true)]
static extern int HcsDetachOverlayFilter(
    [MarshalAs(UnmanagedType.LPWStr)] string VolumeMountPoint,   // LPCWSTR
    [MarshalAs(UnmanagedType.LPWStr)] string LayerData   // LPCWSTR
);
<DllImport("computestorage.dll", ExactSpelling:=True)>
Public Shared Function HcsDetachOverlayFilter(
    <MarshalAs(UnmanagedType.LPWStr)> VolumeMountPoint As String,   ' LPCWSTR
    <MarshalAs(UnmanagedType.LPWStr)> LayerData As String   ' LPCWSTR
) As Integer
End Function
' VolumeMountPoint : LPCWSTR
' LayerData : LPCWSTR
Declare PtrSafe Function HcsDetachOverlayFilter Lib "computestorage" ( _
    ByVal VolumeMountPoint As LongPtr, _
    ByVal LayerData As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

HcsDetachOverlayFilter = ctypes.windll.computestorage.HcsDetachOverlayFilter
HcsDetachOverlayFilter.restype = ctypes.c_int
HcsDetachOverlayFilter.argtypes = [
    wintypes.LPCWSTR,  # VolumeMountPoint : LPCWSTR
    wintypes.LPCWSTR,  # LayerData : LPCWSTR
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('computestorage.dll')
HcsDetachOverlayFilter = Fiddle::Function.new(
  lib['HcsDetachOverlayFilter'],
  [
    Fiddle::TYPE_VOIDP,  # VolumeMountPoint : LPCWSTR
    Fiddle::TYPE_VOIDP,  # LayerData : LPCWSTR
  ],
  Fiddle::TYPE_INT)
#[link(name = "computestorage")]
extern "system" {
    fn HcsDetachOverlayFilter(
        VolumeMountPoint: *const u16,  // LPCWSTR
        LayerData: *const u16  // LPCWSTR
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("computestorage.dll")]
public static extern int HcsDetachOverlayFilter([MarshalAs(UnmanagedType.LPWStr)] string VolumeMountPoint, [MarshalAs(UnmanagedType.LPWStr)] string LayerData);
"@
$api = Add-Type -MemberDefinition $sig -Name 'computestorage_HcsDetachOverlayFilter' -Namespace Win32 -PassThru
# $api::HcsDetachOverlayFilter(VolumeMountPoint, LayerData)
#uselib "computestorage.dll"
#func global HcsDetachOverlayFilter "HcsDetachOverlayFilter" sptr, sptr
; HcsDetachOverlayFilter VolumeMountPoint, LayerData   ; 戻り値は stat
; VolumeMountPoint : LPCWSTR -> "sptr"
; LayerData : LPCWSTR -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "computestorage.dll"
#cfunc global HcsDetachOverlayFilter "HcsDetachOverlayFilter" wstr, wstr
; res = HcsDetachOverlayFilter(VolumeMountPoint, LayerData)
; VolumeMountPoint : LPCWSTR -> "wstr"
; LayerData : LPCWSTR -> "wstr"
; HRESULT HcsDetachOverlayFilter(LPCWSTR VolumeMountPoint, LPCWSTR LayerData)
#uselib "computestorage.dll"
#cfunc global HcsDetachOverlayFilter "HcsDetachOverlayFilter" wstr, wstr
; res = HcsDetachOverlayFilter(VolumeMountPoint, LayerData)
; VolumeMountPoint : LPCWSTR -> "wstr"
; LayerData : LPCWSTR -> "wstr"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	computestorage = windows.NewLazySystemDLL("computestorage.dll")
	procHcsDetachOverlayFilter = computestorage.NewProc("HcsDetachOverlayFilter")
)

// VolumeMountPoint (LPCWSTR), LayerData (LPCWSTR)
r1, _, err := procHcsDetachOverlayFilter.Call(
	uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(VolumeMountPoint))),
	uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(LayerData))),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // HRESULT
function HcsDetachOverlayFilter(
  VolumeMountPoint: PWideChar;   // LPCWSTR
  LayerData: PWideChar   // LPCWSTR
): Integer; stdcall;
  external 'computestorage.dll' name 'HcsDetachOverlayFilter';
result := DllCall("computestorage\HcsDetachOverlayFilter"
    , "WStr", VolumeMountPoint   ; LPCWSTR
    , "WStr", LayerData   ; LPCWSTR
    , "Int")   ; return: HRESULT
●HcsDetachOverlayFilter(VolumeMountPoint, LayerData) = DLL("computestorage.dll", "int HcsDetachOverlayFilter(char*, char*)")
# 呼び出し: HcsDetachOverlayFilter(VolumeMountPoint, LayerData)
# VolumeMountPoint : LPCWSTR -> "char*"
# LayerData : LPCWSTR -> "char*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
const std = @import("std");

extern "computestorage" fn HcsDetachOverlayFilter(
    VolumeMountPoint: [*c]const u16, // LPCWSTR
    LayerData: [*c]const u16 // LPCWSTR
) callconv(std.os.windows.WINAPI) i32;
proc HcsDetachOverlayFilter(
    VolumeMountPoint: WideCString,  # LPCWSTR
    LayerData: WideCString  # LPCWSTR
): int32 {.importc: "HcsDetachOverlayFilter", stdcall, dynlib: "computestorage.dll".}
pragma(lib, "computestorage");
extern(Windows)
int HcsDetachOverlayFilter(
    const(wchar)* VolumeMountPoint,   // LPCWSTR
    const(wchar)* LayerData   // LPCWSTR
);
ccall((:HcsDetachOverlayFilter, "computestorage.dll"), stdcall, Int32,
      (Cwstring, Cwstring),
      VolumeMountPoint, LayerData)
# VolumeMountPoint : LPCWSTR -> Cwstring
# LayerData : LPCWSTR -> Cwstring
# stdcall は 32bit のみ意味を持つ(x64 では無視)。
local ffi = require("ffi")
ffi.cdef[[
int32_t HcsDetachOverlayFilter(
    const uint16_t* VolumeMountPoint,
    const uint16_t* LayerData);
]]
local computestorage = ffi.load("computestorage")
-- computestorage.HcsDetachOverlayFilter(VolumeMountPoint, LayerData)
-- VolumeMountPoint : LPCWSTR
-- LayerData : LPCWSTR
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
const koffi = require('koffi');
const lib = koffi.load('computestorage.dll');
const HcsDetachOverlayFilter = lib.func('__stdcall', 'HcsDetachOverlayFilter', 'int32_t', ['str16', 'str16']);
// HcsDetachOverlayFilter(VolumeMountPoint, LayerData)
// VolumeMountPoint : LPCWSTR -> 'str16'
// LayerData : LPCWSTR -> 'str16'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
const lib = Deno.dlopen("computestorage.dll", {
  HcsDetachOverlayFilter: { parameters: ["buffer", "buffer"], result: "i32" },
});
// lib.symbols.HcsDetachOverlayFilter(VolumeMountPoint, LayerData)
// VolumeMountPoint : LPCWSTR -> "buffer"
// LayerData : LPCWSTR -> "buffer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。
<?php
$ffi = FFI::cdef(<<<C
int32_t HcsDetachOverlayFilter(
    const uint16_t* VolumeMountPoint,
    const uint16_t* LayerData);
C, "computestorage.dll");
// $ffi->HcsDetachOverlayFilter(VolumeMountPoint, LayerData);
// VolumeMountPoint : LPCWSTR
// LayerData : LPCWSTR
// 構造体/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 Computestorage extends StdCallLibrary {
    Computestorage INSTANCE = Native.load("computestorage", Computestorage.class);
    int HcsDetachOverlayFilter(
        WString VolumeMountPoint,   // LPCWSTR
        WString LayerData   // LPCWSTR
    );
}
@[Link("computestorage")]
lib Libcomputestorage
  fun HcsDetachOverlayFilter = HcsDetachOverlayFilter(
    VolumeMountPoint : UInt16*,   # LPCWSTR
    LayerData : UInt16*   # LPCWSTR
  ) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。
import 'dart:ffi';
import 'package:ffi/ffi.dart';

typedef HcsDetachOverlayFilterNative = Int32 Function(Pointer<Utf16>, Pointer<Utf16>);
typedef HcsDetachOverlayFilterDart = int Function(Pointer<Utf16>, Pointer<Utf16>);
final HcsDetachOverlayFilter = DynamicLibrary.open('computestorage.dll')
    .lookupFunction<HcsDetachOverlayFilterNative, HcsDetachOverlayFilterDart>('HcsDetachOverlayFilter');
// VolumeMountPoint : LPCWSTR -> Pointer<Utf16>
// LayerData : LPCWSTR -> Pointer<Utf16>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
function HcsDetachOverlayFilter(
  VolumeMountPoint: PWideChar;   // LPCWSTR
  LayerData: PWideChar   // LPCWSTR
): Integer; stdcall;
  external 'computestorage.dll' name 'HcsDetachOverlayFilter';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import stdcall safe "HcsDetachOverlayFilter"
  c_HcsDetachOverlayFilter :: CWString -> CWString -> IO Int32
-- VolumeMountPoint : LPCWSTR -> CWString
-- LayerData : LPCWSTR -> CWString
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let hcsdetachoverlayfilter =
  foreign "HcsDetachOverlayFilter"
    ((ptr uint16_t) @-> (ptr uint16_t) @-> returning int32_t)
(* VolumeMountPoint : LPCWSTR -> (ptr uint16_t) *)
(* LayerData : LPCWSTR -> (ptr uint16_t) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)
(cffi:define-foreign-library computestorage (t "computestorage.dll"))
(cffi:use-foreign-library computestorage)

(cffi:defcfun ("HcsDetachOverlayFilter" hcs-detach-overlay-filter :convention :stdcall) :int32
  (volume-mount-point (:string :encoding :utf-16le))   ; LPCWSTR
  (layer-data (:string :encoding :utf-16le)))   ; LPCWSTR
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $HcsDetachOverlayFilter = Win32::API::More->new('computestorage',
    'int HcsDetachOverlayFilter(LPCWSTR VolumeMountPoint, LPCWSTR LayerData)');
# my $ret = $HcsDetachOverlayFilter->Call($VolumeMountPoint, $LayerData);
# VolumeMountPoint : LPCWSTR -> LPCWSTR
# LayerData : LPCWSTR -> LPCWSTR
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。