ホーム › System.ApplicationInstallationAndServicing › MsiSourceListClearSourceW
MsiSourceListClearSourceW
関数製品やパッチのソースリストから指定したソースを削除する。
シグネチャ
// msi.dll (Unicode / -W)
#include <windows.h>
DWORD MsiSourceListClearSourceW(
LPCWSTR szProductCodeOrPatchCode,
LPCWSTR szUserSid, // optional
MSIINSTALLCONTEXT dwContext,
DWORD dwOptions,
LPCWSTR szSource
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| szProductCodeOrPatchCode | LPCWSTR | in |
| szUserSid | LPCWSTR | inoptional |
| dwContext | MSIINSTALLCONTEXT | in |
| dwOptions | DWORD | in |
| szSource | LPCWSTR | in |
戻り値の型: DWORD
各言語での呼び出し定義
// msi.dll (Unicode / -W)
#include <windows.h>
DWORD MsiSourceListClearSourceW(
LPCWSTR szProductCodeOrPatchCode,
LPCWSTR szUserSid, // optional
MSIINSTALLCONTEXT dwContext,
DWORD dwOptions,
LPCWSTR szSource
);[DllImport("msi.dll", CharSet = CharSet.Unicode, ExactSpelling = true)]
static extern uint MsiSourceListClearSourceW(
[MarshalAs(UnmanagedType.LPWStr)] string szProductCodeOrPatchCode, // LPCWSTR
[MarshalAs(UnmanagedType.LPWStr)] string szUserSid, // LPCWSTR optional
int dwContext, // MSIINSTALLCONTEXT
uint dwOptions, // DWORD
[MarshalAs(UnmanagedType.LPWStr)] string szSource // LPCWSTR
);<DllImport("msi.dll", CharSet:=CharSet.Unicode, ExactSpelling:=True)>
Public Shared Function MsiSourceListClearSourceW(
<MarshalAs(UnmanagedType.LPWStr)> szProductCodeOrPatchCode As String, ' LPCWSTR
<MarshalAs(UnmanagedType.LPWStr)> szUserSid As String, ' LPCWSTR optional
dwContext As Integer, ' MSIINSTALLCONTEXT
dwOptions As UInteger, ' DWORD
<MarshalAs(UnmanagedType.LPWStr)> szSource As String ' LPCWSTR
) As UInteger
End Function' szProductCodeOrPatchCode : LPCWSTR
' szUserSid : LPCWSTR optional
' dwContext : MSIINSTALLCONTEXT
' dwOptions : DWORD
' szSource : LPCWSTR
Declare PtrSafe Function MsiSourceListClearSourceW Lib "msi" ( _
ByVal szProductCodeOrPatchCode As LongPtr, _
ByVal szUserSid As LongPtr, _
ByVal dwContext As Long, _
ByVal dwOptions As Long, _
ByVal szSource As LongPtr) 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
MsiSourceListClearSourceW = ctypes.windll.msi.MsiSourceListClearSourceW
MsiSourceListClearSourceW.restype = wintypes.DWORD
MsiSourceListClearSourceW.argtypes = [
wintypes.LPCWSTR, # szProductCodeOrPatchCode : LPCWSTR
wintypes.LPCWSTR, # szUserSid : LPCWSTR optional
ctypes.c_int, # dwContext : MSIINSTALLCONTEXT
wintypes.DWORD, # dwOptions : DWORD
wintypes.LPCWSTR, # szSource : LPCWSTR
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('msi.dll')
MsiSourceListClearSourceW = Fiddle::Function.new(
lib['MsiSourceListClearSourceW'],
[
Fiddle::TYPE_VOIDP, # szProductCodeOrPatchCode : LPCWSTR
Fiddle::TYPE_VOIDP, # szUserSid : LPCWSTR optional
Fiddle::TYPE_INT, # dwContext : MSIINSTALLCONTEXT
-Fiddle::TYPE_INT, # dwOptions : DWORD
Fiddle::TYPE_VOIDP, # szSource : LPCWSTR
],
-Fiddle::TYPE_INT)
# Wide strings: pass str.encode("UTF-16LE") + "\x00\x00"#[link(name = "msi")]
extern "system" {
fn MsiSourceListClearSourceW(
szProductCodeOrPatchCode: *const u16, // LPCWSTR
szUserSid: *const u16, // LPCWSTR optional
dwContext: i32, // MSIINSTALLCONTEXT
dwOptions: u32, // DWORD
szSource: *const u16 // LPCWSTR
) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("msi.dll", CharSet = CharSet.Unicode)]
public static extern uint MsiSourceListClearSourceW([MarshalAs(UnmanagedType.LPWStr)] string szProductCodeOrPatchCode, [MarshalAs(UnmanagedType.LPWStr)] string szUserSid, int dwContext, uint dwOptions, [MarshalAs(UnmanagedType.LPWStr)] string szSource);
"@
$api = Add-Type -MemberDefinition $sig -Name 'msi_MsiSourceListClearSourceW' -Namespace Win32 -PassThru
# $api::MsiSourceListClearSourceW(szProductCodeOrPatchCode, szUserSid, dwContext, dwOptions, szSource)#uselib "msi.dll"
#func global MsiSourceListClearSourceW "MsiSourceListClearSourceW" wptr, wptr, wptr, wptr, wptr
; MsiSourceListClearSourceW szProductCodeOrPatchCode, szUserSid, dwContext, dwOptions, szSource ; 戻り値は stat
; szProductCodeOrPatchCode : LPCWSTR -> "wptr"
; szUserSid : LPCWSTR optional -> "wptr"
; dwContext : MSIINSTALLCONTEXT -> "wptr"
; dwOptions : DWORD -> "wptr"
; szSource : LPCWSTR -> "wptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "msi.dll"
#cfunc global MsiSourceListClearSourceW "MsiSourceListClearSourceW" wstr, wstr, int, int, wstr
; res = MsiSourceListClearSourceW(szProductCodeOrPatchCode, szUserSid, dwContext, dwOptions, szSource)
; szProductCodeOrPatchCode : LPCWSTR -> "wstr"
; szUserSid : LPCWSTR optional -> "wstr"
; dwContext : MSIINSTALLCONTEXT -> "int"
; dwOptions : DWORD -> "int"
; szSource : LPCWSTR -> "wstr"; DWORD MsiSourceListClearSourceW(LPCWSTR szProductCodeOrPatchCode, LPCWSTR szUserSid, MSIINSTALLCONTEXT dwContext, DWORD dwOptions, LPCWSTR szSource)
#uselib "msi.dll"
#cfunc global MsiSourceListClearSourceW "MsiSourceListClearSourceW" wstr, wstr, int, int, wstr
; res = MsiSourceListClearSourceW(szProductCodeOrPatchCode, szUserSid, dwContext, dwOptions, szSource)
; szProductCodeOrPatchCode : LPCWSTR -> "wstr"
; szUserSid : LPCWSTR optional -> "wstr"
; dwContext : MSIINSTALLCONTEXT -> "int"
; dwOptions : DWORD -> "int"
; szSource : LPCWSTR -> "wstr"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
msi = windows.NewLazySystemDLL("msi.dll")
procMsiSourceListClearSourceW = msi.NewProc("MsiSourceListClearSourceW")
)
// szProductCodeOrPatchCode (LPCWSTR), szUserSid (LPCWSTR optional), dwContext (MSIINSTALLCONTEXT), dwOptions (DWORD), szSource (LPCWSTR)
r1, _, err := procMsiSourceListClearSourceW.Call(
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(szProductCodeOrPatchCode))),
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(szUserSid))),
uintptr(dwContext),
uintptr(dwOptions),
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(szSource))),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // DWORDfunction MsiSourceListClearSourceW(
szProductCodeOrPatchCode: PWideChar; // LPCWSTR
szUserSid: PWideChar; // LPCWSTR optional
dwContext: Integer; // MSIINSTALLCONTEXT
dwOptions: DWORD; // DWORD
szSource: PWideChar // LPCWSTR
): DWORD; stdcall;
external 'msi.dll' name 'MsiSourceListClearSourceW';result := DllCall("msi\MsiSourceListClearSourceW"
, "WStr", szProductCodeOrPatchCode ; LPCWSTR
, "WStr", szUserSid ; LPCWSTR optional
, "Int", dwContext ; MSIINSTALLCONTEXT
, "UInt", dwOptions ; DWORD
, "WStr", szSource ; LPCWSTR
, "UInt") ; return: DWORD●MsiSourceListClearSourceW(szProductCodeOrPatchCode, szUserSid, dwContext, dwOptions, szSource) = DLL("msi.dll", "dword MsiSourceListClearSourceW(char*, char*, int, dword, char*)")
# 呼び出し: MsiSourceListClearSourceW(szProductCodeOrPatchCode, szUserSid, dwContext, dwOptions, szSource)
# szProductCodeOrPatchCode : LPCWSTR -> "char*"
# szUserSid : LPCWSTR optional -> "char*"
# dwContext : MSIINSTALLCONTEXT -> "int"
# dwOptions : DWORD -> "dword"
# szSource : LPCWSTR -> "char*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※-W(Unicode)関数。なでしこ1はANSIのため -A 版の利用を推奨。