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

MsiSourceListForceResolutionW

関数
次回ソース使用時にソースを再解決するよう強制する。
DLLmsi.dll文字セットUnicode (-W)呼出規約winapi対応OSwindows8.0

シグネチャ

// msi.dll  (Unicode / -W)
#include <windows.h>

DWORD MsiSourceListForceResolutionW(
    LPCWSTR szProduct,
    LPCWSTR szUserName,   // optional
    DWORD dwReserved   // optional
);

パラメーター

名前方向
szProductLPCWSTRin
szUserNameLPCWSTRinoptional
dwReservedDWORDoptional

戻り値の型: DWORD

各言語での呼び出し定義

// msi.dll  (Unicode / -W)
#include <windows.h>

DWORD MsiSourceListForceResolutionW(
    LPCWSTR szProduct,
    LPCWSTR szUserName,   // optional
    DWORD dwReserved   // optional
);
[DllImport("msi.dll", CharSet = CharSet.Unicode, ExactSpelling = true)]
static extern uint MsiSourceListForceResolutionW(
    [MarshalAs(UnmanagedType.LPWStr)] string szProduct,   // LPCWSTR
    [MarshalAs(UnmanagedType.LPWStr)] string szUserName,   // LPCWSTR optional
    uint dwReserved   // DWORD optional
);
<DllImport("msi.dll", CharSet:=CharSet.Unicode, ExactSpelling:=True)>
Public Shared Function MsiSourceListForceResolutionW(
    <MarshalAs(UnmanagedType.LPWStr)> szProduct As String,   ' LPCWSTR
    <MarshalAs(UnmanagedType.LPWStr)> szUserName As String,   ' LPCWSTR optional
    dwReserved As UInteger   ' DWORD optional
) As UInteger
End Function
' szProduct : LPCWSTR
' szUserName : LPCWSTR optional
' dwReserved : DWORD optional
Declare PtrSafe Function MsiSourceListForceResolutionW Lib "msi" ( _
    ByVal szProduct As LongPtr, _
    ByVal szUserName As LongPtr, _
    ByVal dwReserved As Long) As Long
' Unicode(W): 文字列は ByVal As LongPtr とし StrPtr(unicodeStr) を渡す
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

MsiSourceListForceResolutionW = ctypes.windll.msi.MsiSourceListForceResolutionW
MsiSourceListForceResolutionW.restype = wintypes.DWORD
MsiSourceListForceResolutionW.argtypes = [
    wintypes.LPCWSTR,  # szProduct : LPCWSTR
    wintypes.LPCWSTR,  # szUserName : LPCWSTR optional
    wintypes.DWORD,  # dwReserved : DWORD optional
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('msi.dll')
MsiSourceListForceResolutionW = Fiddle::Function.new(
  lib['MsiSourceListForceResolutionW'],
  [
    Fiddle::TYPE_VOIDP,  # szProduct : LPCWSTR
    Fiddle::TYPE_VOIDP,  # szUserName : LPCWSTR optional
    -Fiddle::TYPE_INT,  # dwReserved : DWORD optional
  ],
  -Fiddle::TYPE_INT)
# Wide strings: pass str.encode("UTF-16LE") + "\x00\x00"
#[link(name = "msi")]
extern "system" {
    fn MsiSourceListForceResolutionW(
        szProduct: *const u16,  // LPCWSTR
        szUserName: *const u16,  // LPCWSTR optional
        dwReserved: u32  // DWORD optional
    ) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("msi.dll", CharSet = CharSet.Unicode)]
public static extern uint MsiSourceListForceResolutionW([MarshalAs(UnmanagedType.LPWStr)] string szProduct, [MarshalAs(UnmanagedType.LPWStr)] string szUserName, uint dwReserved);
"@
$api = Add-Type -MemberDefinition $sig -Name 'msi_MsiSourceListForceResolutionW' -Namespace Win32 -PassThru
# $api::MsiSourceListForceResolutionW(szProduct, szUserName, dwReserved)
#uselib "msi.dll"
#func global MsiSourceListForceResolutionW "MsiSourceListForceResolutionW" wptr, wptr, wptr
; MsiSourceListForceResolutionW szProduct, szUserName, dwReserved   ; 戻り値は stat
; szProduct : LPCWSTR -> "wptr"
; szUserName : LPCWSTR optional -> "wptr"
; dwReserved : DWORD optional -> "wptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "msi.dll"
#cfunc global MsiSourceListForceResolutionW "MsiSourceListForceResolutionW" wstr, wstr, int
; res = MsiSourceListForceResolutionW(szProduct, szUserName, dwReserved)
; szProduct : LPCWSTR -> "wstr"
; szUserName : LPCWSTR optional -> "wstr"
; dwReserved : DWORD optional -> "int"
; DWORD MsiSourceListForceResolutionW(LPCWSTR szProduct, LPCWSTR szUserName, DWORD dwReserved)
#uselib "msi.dll"
#cfunc global MsiSourceListForceResolutionW "MsiSourceListForceResolutionW" wstr, wstr, int
; res = MsiSourceListForceResolutionW(szProduct, szUserName, dwReserved)
; szProduct : LPCWSTR -> "wstr"
; szUserName : LPCWSTR optional -> "wstr"
; dwReserved : DWORD optional -> "int"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	msi = windows.NewLazySystemDLL("msi.dll")
	procMsiSourceListForceResolutionW = msi.NewProc("MsiSourceListForceResolutionW")
)

// szProduct (LPCWSTR), szUserName (LPCWSTR optional), dwReserved (DWORD optional)
r1, _, err := procMsiSourceListForceResolutionW.Call(
	uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(szProduct))),
	uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(szUserName))),
	uintptr(dwReserved),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // DWORD
function MsiSourceListForceResolutionW(
  szProduct: PWideChar;   // LPCWSTR
  szUserName: PWideChar;   // LPCWSTR optional
  dwReserved: DWORD   // DWORD optional
): DWORD; stdcall;
  external 'msi.dll' name 'MsiSourceListForceResolutionW';
result := DllCall("msi\MsiSourceListForceResolutionW"
    , "WStr", szProduct   ; LPCWSTR
    , "WStr", szUserName   ; LPCWSTR optional
    , "UInt", dwReserved   ; DWORD optional
    , "UInt")   ; return: DWORD
●MsiSourceListForceResolutionW(szProduct, szUserName, dwReserved) = DLL("msi.dll", "dword MsiSourceListForceResolutionW(char*, char*, dword)")
# 呼び出し: MsiSourceListForceResolutionW(szProduct, szUserName, dwReserved)
# szProduct : LPCWSTR -> "char*"
# szUserName : LPCWSTR optional -> "char*"
# dwReserved : DWORD optional -> "dword"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※-W(Unicode)関数。なでしこ1はANSIのため -A 版の利用を推奨。