Win32 API 日本語リファレンス
ホームStorage.FileSystem › WofWimUpdateEntry

WofWimUpdateEntry

関数
WIMデータソースのWIMパスを更新する。
DLLWOFUTIL.dll呼出規約winapi

シグネチャ

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

HRESULT WofWimUpdateEntry(
    LPCWSTR VolumeName,
    LONGLONG DataSourceId,
    LPCWSTR NewWimPath
);

パラメーター

名前方向
VolumeNameLPCWSTRin
DataSourceIdLONGLONGin
NewWimPathLPCWSTRin

戻り値の型: HRESULT

各言語での呼び出し定義

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

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

WofWimUpdateEntry = ctypes.windll.wofutil.WofWimUpdateEntry
WofWimUpdateEntry.restype = ctypes.c_int
WofWimUpdateEntry.argtypes = [
    wintypes.LPCWSTR,  # VolumeName : LPCWSTR
    ctypes.c_longlong,  # DataSourceId : LONGLONG
    wintypes.LPCWSTR,  # NewWimPath : LPCWSTR
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('WOFUTIL.dll')
WofWimUpdateEntry = Fiddle::Function.new(
  lib['WofWimUpdateEntry'],
  [
    Fiddle::TYPE_VOIDP,  # VolumeName : LPCWSTR
    Fiddle::TYPE_LONG_LONG,  # DataSourceId : LONGLONG
    Fiddle::TYPE_VOIDP,  # NewWimPath : LPCWSTR
  ],
  Fiddle::TYPE_INT)
#[link(name = "wofutil")]
extern "system" {
    fn WofWimUpdateEntry(
        VolumeName: *const u16,  // LPCWSTR
        DataSourceId: i64,  // LONGLONG
        NewWimPath: *const u16  // LPCWSTR
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("WOFUTIL.dll")]
public static extern int WofWimUpdateEntry([MarshalAs(UnmanagedType.LPWStr)] string VolumeName, long DataSourceId, [MarshalAs(UnmanagedType.LPWStr)] string NewWimPath);
"@
$api = Add-Type -MemberDefinition $sig -Name 'WOFUTIL_WofWimUpdateEntry' -Namespace Win32 -PassThru
# $api::WofWimUpdateEntry(VolumeName, DataSourceId, NewWimPath)
#uselib "WOFUTIL.dll"
#func global WofWimUpdateEntry "WofWimUpdateEntry" sptr, sptr, sptr
; WofWimUpdateEntry VolumeName, DataSourceId, NewWimPath   ; 戻り値は stat
; VolumeName : LPCWSTR -> "sptr"
; DataSourceId : LONGLONG -> "sptr"
; NewWimPath : LPCWSTR -> "sptr"
; ※HSP3.7は int64 引数(64bit値渡し)に非対応です。
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "WOFUTIL.dll"
#cfunc global WofWimUpdateEntry "WofWimUpdateEntry" wstr, int64, wstr
; res = WofWimUpdateEntry(VolumeName, DataSourceId, NewWimPath)
; VolumeName : LPCWSTR -> "wstr"
; DataSourceId : LONGLONG -> "int64"
; NewWimPath : LPCWSTR -> "wstr"
; ※int64 引数の DLL 値渡しは x64 ランタイム(hsp3_64)のみ対応(x86 は未対応)。
; HRESULT WofWimUpdateEntry(LPCWSTR VolumeName, LONGLONG DataSourceId, LPCWSTR NewWimPath)
#uselib "WOFUTIL.dll"
#cfunc global WofWimUpdateEntry "WofWimUpdateEntry" wstr, int64, wstr
; res = WofWimUpdateEntry(VolumeName, DataSourceId, NewWimPath)
; VolumeName : LPCWSTR -> "wstr"
; DataSourceId : LONGLONG -> "int64"
; NewWimPath : LPCWSTR -> "wstr"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	wofutil = windows.NewLazySystemDLL("WOFUTIL.dll")
	procWofWimUpdateEntry = wofutil.NewProc("WofWimUpdateEntry")
)

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