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

MsiSourceListClearAllW

関数
製品のネットワークソースリストをすべて削除する。
DLLmsi.dll文字セットUnicode (-W)呼出規約winapi対応OSwindows8.0

シグネチャ

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

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

パラメーター

名前方向
szProductLPCWSTRin
szUserNameLPCWSTRinoptional
dwReservedDWORDoptional

戻り値の型: DWORD

各言語での呼び出し定義

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

DWORD MsiSourceListClearAllW(
    LPCWSTR szProduct,
    LPCWSTR szUserName,   // optional
    DWORD dwReserved   // optional
);
[DllImport("msi.dll", CharSet = CharSet.Unicode, ExactSpelling = true)]
static extern uint MsiSourceListClearAllW(
    [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 MsiSourceListClearAllW(
    <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 MsiSourceListClearAllW 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

MsiSourceListClearAllW = ctypes.windll.msi.MsiSourceListClearAllW
MsiSourceListClearAllW.restype = wintypes.DWORD
MsiSourceListClearAllW.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')
MsiSourceListClearAllW = Fiddle::Function.new(
  lib['MsiSourceListClearAllW'],
  [
    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 MsiSourceListClearAllW(
        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 MsiSourceListClearAllW([MarshalAs(UnmanagedType.LPWStr)] string szProduct, [MarshalAs(UnmanagedType.LPWStr)] string szUserName, uint dwReserved);
"@
$api = Add-Type -MemberDefinition $sig -Name 'msi_MsiSourceListClearAllW' -Namespace Win32 -PassThru
# $api::MsiSourceListClearAllW(szProduct, szUserName, dwReserved)
#uselib "msi.dll"
#func global MsiSourceListClearAllW "MsiSourceListClearAllW" wptr, wptr, wptr
; MsiSourceListClearAllW szProduct, szUserName, dwReserved   ; 戻り値は stat
; szProduct : LPCWSTR -> "wptr"
; szUserName : LPCWSTR optional -> "wptr"
; dwReserved : DWORD optional -> "wptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "msi.dll"
#cfunc global MsiSourceListClearAllW "MsiSourceListClearAllW" wstr, wstr, int
; res = MsiSourceListClearAllW(szProduct, szUserName, dwReserved)
; szProduct : LPCWSTR -> "wstr"
; szUserName : LPCWSTR optional -> "wstr"
; dwReserved : DWORD optional -> "int"
; DWORD MsiSourceListClearAllW(LPCWSTR szProduct, LPCWSTR szUserName, DWORD dwReserved)
#uselib "msi.dll"
#cfunc global MsiSourceListClearAllW "MsiSourceListClearAllW" wstr, wstr, int
; res = MsiSourceListClearAllW(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")
	procMsiSourceListClearAllW = msi.NewProc("MsiSourceListClearAllW")
)

// szProduct (LPCWSTR), szUserName (LPCWSTR optional), dwReserved (DWORD optional)
r1, _, err := procMsiSourceListClearAllW.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 MsiSourceListClearAllW(
  szProduct: PWideChar;   // LPCWSTR
  szUserName: PWideChar;   // LPCWSTR optional
  dwReserved: DWORD   // DWORD optional
): DWORD; stdcall;
  external 'msi.dll' name 'MsiSourceListClearAllW';
result := DllCall("msi\MsiSourceListClearAllW"
    , "WStr", szProduct   ; LPCWSTR
    , "WStr", szUserName   ; LPCWSTR optional
    , "UInt", dwReserved   ; DWORD optional
    , "UInt")   ; return: DWORD
●MsiSourceListClearAllW(szProduct, szUserName, dwReserved) = DLL("msi.dll", "dword MsiSourceListClearAllW(char*, char*, dword)")
# 呼び出し: MsiSourceListClearAllW(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 版の利用を推奨。