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

MsiAdvertiseProductExW

関数
オプション指定で製品をアドバタイズする(Unicode版)。
DLLmsi.dll文字セットUnicode (-W)呼出規約winapi対応OSwindows8.0

シグネチャ

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

DWORD MsiAdvertiseProductExW(
    LPCWSTR szPackagePath,
    LPCWSTR szScriptfilePath,   // optional
    LPCWSTR szTransforms,   // optional
    WORD lgidLanguage,
    DWORD dwPlatform,
    DWORD dwOptions
);

パラメーター

名前方向
szPackagePathLPCWSTRin
szScriptfilePathLPCWSTRinoptional
szTransformsLPCWSTRinoptional
lgidLanguageWORDin
dwPlatformDWORDin
dwOptionsDWORDin

戻り値の型: DWORD

各言語での呼び出し定義

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

DWORD MsiAdvertiseProductExW(
    LPCWSTR szPackagePath,
    LPCWSTR szScriptfilePath,   // optional
    LPCWSTR szTransforms,   // optional
    WORD lgidLanguage,
    DWORD dwPlatform,
    DWORD dwOptions
);
[DllImport("msi.dll", CharSet = CharSet.Unicode, ExactSpelling = true)]
static extern uint MsiAdvertiseProductExW(
    [MarshalAs(UnmanagedType.LPWStr)] string szPackagePath,   // LPCWSTR
    [MarshalAs(UnmanagedType.LPWStr)] string szScriptfilePath,   // LPCWSTR optional
    [MarshalAs(UnmanagedType.LPWStr)] string szTransforms,   // LPCWSTR optional
    ushort lgidLanguage,   // WORD
    uint dwPlatform,   // DWORD
    uint dwOptions   // DWORD
);
<DllImport("msi.dll", CharSet:=CharSet.Unicode, ExactSpelling:=True)>
Public Shared Function MsiAdvertiseProductExW(
    <MarshalAs(UnmanagedType.LPWStr)> szPackagePath As String,   ' LPCWSTR
    <MarshalAs(UnmanagedType.LPWStr)> szScriptfilePath As String,   ' LPCWSTR optional
    <MarshalAs(UnmanagedType.LPWStr)> szTransforms As String,   ' LPCWSTR optional
    lgidLanguage As UShort,   ' WORD
    dwPlatform As UInteger,   ' DWORD
    dwOptions As UInteger   ' DWORD
) As UInteger
End Function
' szPackagePath : LPCWSTR
' szScriptfilePath : LPCWSTR optional
' szTransforms : LPCWSTR optional
' lgidLanguage : WORD
' dwPlatform : DWORD
' dwOptions : DWORD
Declare PtrSafe Function MsiAdvertiseProductExW Lib "msi" ( _
    ByVal szPackagePath As LongPtr, _
    ByVal szScriptfilePath As LongPtr, _
    ByVal szTransforms As LongPtr, _
    ByVal lgidLanguage As Integer, _
    ByVal dwPlatform As Long, _
    ByVal dwOptions 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

MsiAdvertiseProductExW = ctypes.windll.msi.MsiAdvertiseProductExW
MsiAdvertiseProductExW.restype = wintypes.DWORD
MsiAdvertiseProductExW.argtypes = [
    wintypes.LPCWSTR,  # szPackagePath : LPCWSTR
    wintypes.LPCWSTR,  # szScriptfilePath : LPCWSTR optional
    wintypes.LPCWSTR,  # szTransforms : LPCWSTR optional
    ctypes.c_ushort,  # lgidLanguage : WORD
    wintypes.DWORD,  # dwPlatform : DWORD
    wintypes.DWORD,  # dwOptions : DWORD
]
require 'fiddle'
require 'fiddle/import'

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

var (
	msi = windows.NewLazySystemDLL("msi.dll")
	procMsiAdvertiseProductExW = msi.NewProc("MsiAdvertiseProductExW")
)

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