ホーム › Storage.FileSystem › WofWimUpdateEntry
WofWimUpdateEntry
関数WIMデータソースのWIMパスを更新する。
シグネチャ
// WOFUTIL.dll
#include <windows.h>
HRESULT WofWimUpdateEntry(
LPCWSTR VolumeName,
LONGLONG DataSourceId,
LPCWSTR NewWimPath
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| VolumeName | LPCWSTR | in | WIM によってデータが提供されるファイルを含むボリューム名。 |
| DataSourceId | LONGLONG | in | WIM エントリを識別します。 |
| NewWimPath | LPCWSTR | in | WIM ファイルの新しい場所。 |
戻り値の型: HRESULT
公式ドキュメント
WIM エントリを更新し、別の WIM ファイルの場所を指すようにします。
戻り値
この関数が成功した場合は S_OK を返します。それ以外の場合は HRESULT エラーコードを返します。
出典・ライセンス: 上記「公式ドキュメント」の内容は Microsoft の Win32 API ドキュメント(MicrosoftDocs/sdk-api)を日本語に翻訳・改変したものです。© Microsoft Corporation. CC BY 4.0 で提供。
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)
各言語での呼び出し定義
// 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 // HRESULTfunction 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)。const std = @import("std");
extern "wofutil" fn WofWimUpdateEntry(
VolumeName: [*c]const u16, // LPCWSTR
DataSourceId: i64, // LONGLONG
NewWimPath: [*c]const u16 // LPCWSTR
) callconv(std.os.windows.WINAPI) i32;proc WofWimUpdateEntry(
VolumeName: WideCString, # LPCWSTR
DataSourceId: int64, # LONGLONG
NewWimPath: WideCString # LPCWSTR
): int32 {.importc: "WofWimUpdateEntry", stdcall, dynlib: "WOFUTIL.dll".}pragma(lib, "wofutil");
extern(Windows)
int WofWimUpdateEntry(
const(wchar)* VolumeName, // LPCWSTR
long DataSourceId, // LONGLONG
const(wchar)* NewWimPath // LPCWSTR
);ccall((:WofWimUpdateEntry, "WOFUTIL.dll"), stdcall, Int32,
(Cwstring, Int64, Cwstring),
VolumeName, DataSourceId, NewWimPath)
# VolumeName : LPCWSTR -> Cwstring
# DataSourceId : LONGLONG -> Int64
# NewWimPath : LPCWSTR -> Cwstring
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
int32_t WofWimUpdateEntry(
const uint16_t* VolumeName,
int64_t DataSourceId,
const uint16_t* NewWimPath);
]]
local wofutil = ffi.load("wofutil")
-- wofutil.WofWimUpdateEntry(VolumeName, DataSourceId, NewWimPath)
-- VolumeName : LPCWSTR
-- DataSourceId : LONGLONG
-- NewWimPath : LPCWSTR
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('WOFUTIL.dll');
const WofWimUpdateEntry = lib.func('__stdcall', 'WofWimUpdateEntry', 'int32_t', ['str16', 'int64_t', 'str16']);
// WofWimUpdateEntry(VolumeName, DataSourceId, NewWimPath)
// VolumeName : LPCWSTR -> 'str16'
// DataSourceId : LONGLONG -> 'int64_t'
// NewWimPath : LPCWSTR -> 'str16'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("WOFUTIL.dll", {
WofWimUpdateEntry: { parameters: ["buffer", "i64", "buffer"], result: "i32" },
});
// lib.symbols.WofWimUpdateEntry(VolumeName, DataSourceId, NewWimPath)
// VolumeName : LPCWSTR -> "buffer"
// DataSourceId : LONGLONG -> "i64"
// NewWimPath : LPCWSTR -> "buffer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
int32_t WofWimUpdateEntry(
const uint16_t* VolumeName,
int64_t DataSourceId,
const uint16_t* NewWimPath);
C, "WOFUTIL.dll");
// $ffi->WofWimUpdateEntry(VolumeName, DataSourceId, NewWimPath);
// VolumeName : LPCWSTR
// DataSourceId : LONGLONG
// NewWimPath : 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 Wofutil extends StdCallLibrary {
Wofutil INSTANCE = Native.load("wofutil", Wofutil.class);
int WofWimUpdateEntry(
WString VolumeName, // LPCWSTR
long DataSourceId, // LONGLONG
WString NewWimPath // LPCWSTR
);
}@[Link("wofutil")]
lib LibWOFUTIL
fun WofWimUpdateEntry = WofWimUpdateEntry(
VolumeName : UInt16*, # LPCWSTR
DataSourceId : Int64, # LONGLONG
NewWimPath : 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 WofWimUpdateEntryNative = Int32 Function(Pointer<Utf16>, Int64, Pointer<Utf16>);
typedef WofWimUpdateEntryDart = int Function(Pointer<Utf16>, int, Pointer<Utf16>);
final WofWimUpdateEntry = DynamicLibrary.open('WOFUTIL.dll')
.lookupFunction<WofWimUpdateEntryNative, WofWimUpdateEntryDart>('WofWimUpdateEntry');
// VolumeName : LPCWSTR -> Pointer<Utf16>
// DataSourceId : LONGLONG -> Int64
// NewWimPath : LPCWSTR -> Pointer<Utf16>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function WofWimUpdateEntry(
VolumeName: PWideChar; // LPCWSTR
DataSourceId: Int64; // LONGLONG
NewWimPath: PWideChar // LPCWSTR
): Integer; stdcall;
external 'WOFUTIL.dll' name 'WofWimUpdateEntry';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "WofWimUpdateEntry"
c_WofWimUpdateEntry :: CWString -> Int64 -> CWString -> IO Int32
-- VolumeName : LPCWSTR -> CWString
-- DataSourceId : LONGLONG -> Int64
-- NewWimPath : LPCWSTR -> CWString
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let wofwimupdateentry =
foreign "WofWimUpdateEntry"
((ptr uint16_t) @-> int64_t @-> (ptr uint16_t) @-> returning int32_t)
(* VolumeName : LPCWSTR -> (ptr uint16_t) *)
(* DataSourceId : LONGLONG -> int64_t *)
(* NewWimPath : LPCWSTR -> (ptr uint16_t) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library wofutil (t "WOFUTIL.dll"))
(cffi:use-foreign-library wofutil)
(cffi:defcfun ("WofWimUpdateEntry" wof-wim-update-entry :convention :stdcall) :int32
(volume-name (:string :encoding :utf-16le)) ; LPCWSTR
(data-source-id :int64) ; LONGLONG
(new-wim-path (:string :encoding :utf-16le))) ; LPCWSTR
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $WofWimUpdateEntry = Win32::API::More->new('WOFUTIL',
'int WofWimUpdateEntry(LPCWSTR VolumeName, INT64 DataSourceId, LPCWSTR NewWimPath)');
# my $ret = $WofWimUpdateEntry->Call($VolumeName, $DataSourceId, $NewWimPath);
# VolumeName : LPCWSTR -> LPCWSTR
# DataSourceId : LONGLONG -> INT64
# NewWimPath : LPCWSTR -> LPCWSTR
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。