ホーム › Storage.FileSystem › WofWimAddEntry
WofWimAddEntry
関数WIM圧縮プロバイダーにWIMファイルのエントリを追加する。
シグネチャ
// WOFUTIL.dll
#include <windows.h>
HRESULT WofWimAddEntry(
LPCWSTR VolumeName,
LPCWSTR WimPath,
DWORD WimType,
DWORD WimIndex,
LONGLONG* DataSourceId
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| VolumeName | LPCWSTR | in |
| WimPath | LPCWSTR | in |
| WimType | DWORD | in |
| WimIndex | DWORD | in |
| DataSourceId | LONGLONG* | out |
戻り値の型: HRESULT
各言語での呼び出し定義
// WOFUTIL.dll
#include <windows.h>
HRESULT WofWimAddEntry(
LPCWSTR VolumeName,
LPCWSTR WimPath,
DWORD WimType,
DWORD WimIndex,
LONGLONG* DataSourceId
);[DllImport("WOFUTIL.dll", ExactSpelling = true)]
static extern int WofWimAddEntry(
[MarshalAs(UnmanagedType.LPWStr)] string VolumeName, // LPCWSTR
[MarshalAs(UnmanagedType.LPWStr)] string WimPath, // LPCWSTR
uint WimType, // DWORD
uint WimIndex, // DWORD
out long DataSourceId // LONGLONG* out
);<DllImport("WOFUTIL.dll", ExactSpelling:=True)>
Public Shared Function WofWimAddEntry(
<MarshalAs(UnmanagedType.LPWStr)> VolumeName As String, ' LPCWSTR
<MarshalAs(UnmanagedType.LPWStr)> WimPath As String, ' LPCWSTR
WimType As UInteger, ' DWORD
WimIndex As UInteger, ' DWORD
<Out> ByRef DataSourceId As Long ' LONGLONG* out
) As Integer
End Function' VolumeName : LPCWSTR
' WimPath : LPCWSTR
' WimType : DWORD
' WimIndex : DWORD
' DataSourceId : LONGLONG* out
Declare PtrSafe Function WofWimAddEntry Lib "wofutil" ( _
ByVal VolumeName As LongPtr, _
ByVal WimPath As LongPtr, _
ByVal WimType As Long, _
ByVal WimIndex As Long, _
ByRef DataSourceId As LongLong) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
WofWimAddEntry = ctypes.windll.wofutil.WofWimAddEntry
WofWimAddEntry.restype = ctypes.c_int
WofWimAddEntry.argtypes = [
wintypes.LPCWSTR, # VolumeName : LPCWSTR
wintypes.LPCWSTR, # WimPath : LPCWSTR
wintypes.DWORD, # WimType : DWORD
wintypes.DWORD, # WimIndex : DWORD
ctypes.POINTER(ctypes.c_longlong), # DataSourceId : LONGLONG* out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('WOFUTIL.dll')
WofWimAddEntry = Fiddle::Function.new(
lib['WofWimAddEntry'],
[
Fiddle::TYPE_VOIDP, # VolumeName : LPCWSTR
Fiddle::TYPE_VOIDP, # WimPath : LPCWSTR
-Fiddle::TYPE_INT, # WimType : DWORD
-Fiddle::TYPE_INT, # WimIndex : DWORD
Fiddle::TYPE_VOIDP, # DataSourceId : LONGLONG* out
],
Fiddle::TYPE_INT)#[link(name = "wofutil")]
extern "system" {
fn WofWimAddEntry(
VolumeName: *const u16, // LPCWSTR
WimPath: *const u16, // LPCWSTR
WimType: u32, // DWORD
WimIndex: u32, // DWORD
DataSourceId: *mut i64 // LONGLONG* out
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("WOFUTIL.dll")]
public static extern int WofWimAddEntry([MarshalAs(UnmanagedType.LPWStr)] string VolumeName, [MarshalAs(UnmanagedType.LPWStr)] string WimPath, uint WimType, uint WimIndex, out long DataSourceId);
"@
$api = Add-Type -MemberDefinition $sig -Name 'WOFUTIL_WofWimAddEntry' -Namespace Win32 -PassThru
# $api::WofWimAddEntry(VolumeName, WimPath, WimType, WimIndex, DataSourceId)#uselib "WOFUTIL.dll"
#func global WofWimAddEntry "WofWimAddEntry" sptr, sptr, sptr, sptr, sptr
; WofWimAddEntry VolumeName, WimPath, WimType, WimIndex, varptr(DataSourceId) ; 戻り値は stat
; VolumeName : LPCWSTR -> "sptr"
; WimPath : LPCWSTR -> "sptr"
; WimType : DWORD -> "sptr"
; WimIndex : DWORD -> "sptr"
; DataSourceId : LONGLONG* out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "WOFUTIL.dll" #cfunc global WofWimAddEntry "WofWimAddEntry" wstr, wstr, int, int, var ; res = WofWimAddEntry(VolumeName, WimPath, WimType, WimIndex, DataSourceId) ; VolumeName : LPCWSTR -> "wstr" ; WimPath : LPCWSTR -> "wstr" ; WimType : DWORD -> "int" ; WimIndex : DWORD -> "int" ; DataSourceId : LONGLONG* out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "WOFUTIL.dll" #cfunc global WofWimAddEntry "WofWimAddEntry" wstr, wstr, int, int, sptr ; res = WofWimAddEntry(VolumeName, WimPath, WimType, WimIndex, varptr(DataSourceId)) ; VolumeName : LPCWSTR -> "wstr" ; WimPath : LPCWSTR -> "wstr" ; WimType : DWORD -> "int" ; WimIndex : DWORD -> "int" ; DataSourceId : LONGLONG* out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; HRESULT WofWimAddEntry(LPCWSTR VolumeName, LPCWSTR WimPath, DWORD WimType, DWORD WimIndex, LONGLONG* DataSourceId) #uselib "WOFUTIL.dll" #cfunc global WofWimAddEntry "WofWimAddEntry" wstr, wstr, int, int, var ; res = WofWimAddEntry(VolumeName, WimPath, WimType, WimIndex, DataSourceId) ; VolumeName : LPCWSTR -> "wstr" ; WimPath : LPCWSTR -> "wstr" ; WimType : DWORD -> "int" ; WimIndex : DWORD -> "int" ; DataSourceId : LONGLONG* out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; HRESULT WofWimAddEntry(LPCWSTR VolumeName, LPCWSTR WimPath, DWORD WimType, DWORD WimIndex, LONGLONG* DataSourceId) #uselib "WOFUTIL.dll" #cfunc global WofWimAddEntry "WofWimAddEntry" wstr, wstr, int, int, intptr ; res = WofWimAddEntry(VolumeName, WimPath, WimType, WimIndex, varptr(DataSourceId)) ; VolumeName : LPCWSTR -> "wstr" ; WimPath : LPCWSTR -> "wstr" ; WimType : DWORD -> "int" ; WimIndex : DWORD -> "int" ; DataSourceId : LONGLONG* out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
wofutil = windows.NewLazySystemDLL("WOFUTIL.dll")
procWofWimAddEntry = wofutil.NewProc("WofWimAddEntry")
)
// VolumeName (LPCWSTR), WimPath (LPCWSTR), WimType (DWORD), WimIndex (DWORD), DataSourceId (LONGLONG* out)
r1, _, err := procWofWimAddEntry.Call(
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(VolumeName))),
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(WimPath))),
uintptr(WimType),
uintptr(WimIndex),
uintptr(DataSourceId),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HRESULTfunction WofWimAddEntry(
VolumeName: PWideChar; // LPCWSTR
WimPath: PWideChar; // LPCWSTR
WimType: DWORD; // DWORD
WimIndex: DWORD; // DWORD
DataSourceId: Pointer // LONGLONG* out
): Integer; stdcall;
external 'WOFUTIL.dll' name 'WofWimAddEntry';result := DllCall("WOFUTIL\WofWimAddEntry"
, "WStr", VolumeName ; LPCWSTR
, "WStr", WimPath ; LPCWSTR
, "UInt", WimType ; DWORD
, "UInt", WimIndex ; DWORD
, "Ptr", DataSourceId ; LONGLONG* out
, "Int") ; return: HRESULT●WofWimAddEntry(VolumeName, WimPath, WimType, WimIndex, DataSourceId) = DLL("WOFUTIL.dll", "int WofWimAddEntry(char*, char*, dword, dword, void*)")
# 呼び出し: WofWimAddEntry(VolumeName, WimPath, WimType, WimIndex, DataSourceId)
# VolumeName : LPCWSTR -> "char*"
# WimPath : LPCWSTR -> "char*"
# WimType : DWORD -> "dword"
# WimIndex : DWORD -> "dword"
# DataSourceId : LONGLONG* out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。