ホーム › System.ApplicationInstallationAndServicing › MsiSetTargetPathA
MsiSetTargetPathA
関数フォルダーのインストール先ターゲットパスを設定する(ANSI版)。
シグネチャ
// msi.dll (ANSI / -A)
#include <windows.h>
DWORD MsiSetTargetPathA(
MSIHANDLE hInstall,
LPCSTR szFolder,
LPCSTR szFolderPath
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| hInstall | MSIHANDLE | in |
| szFolder | LPCSTR | in |
| szFolderPath | LPCSTR | in |
戻り値の型: DWORD
各言語での呼び出し定義
// msi.dll (ANSI / -A)
#include <windows.h>
DWORD MsiSetTargetPathA(
MSIHANDLE hInstall,
LPCSTR szFolder,
LPCSTR szFolderPath
);[DllImport("msi.dll", CharSet = CharSet.Ansi, ExactSpelling = true)]
static extern uint MsiSetTargetPathA(
uint hInstall, // MSIHANDLE
[MarshalAs(UnmanagedType.LPStr)] string szFolder, // LPCSTR
[MarshalAs(UnmanagedType.LPStr)] string szFolderPath // LPCSTR
);<DllImport("msi.dll", CharSet:=CharSet.Ansi, ExactSpelling:=True)>
Public Shared Function MsiSetTargetPathA(
hInstall As UInteger, ' MSIHANDLE
<MarshalAs(UnmanagedType.LPStr)> szFolder As String, ' LPCSTR
<MarshalAs(UnmanagedType.LPStr)> szFolderPath As String ' LPCSTR
) As UInteger
End Function' hInstall : MSIHANDLE
' szFolder : LPCSTR
' szFolderPath : LPCSTR
Declare PtrSafe Function MsiSetTargetPathA Lib "msi" ( _
ByVal hInstall As Long, _
ByVal szFolder As String, _
ByVal szFolderPath As String) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
MsiSetTargetPathA = ctypes.windll.msi.MsiSetTargetPathA
MsiSetTargetPathA.restype = wintypes.DWORD
MsiSetTargetPathA.argtypes = [
wintypes.DWORD, # hInstall : MSIHANDLE
wintypes.LPCSTR, # szFolder : LPCSTR
wintypes.LPCSTR, # szFolderPath : LPCSTR
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('msi.dll')
MsiSetTargetPathA = Fiddle::Function.new(
lib['MsiSetTargetPathA'],
[
-Fiddle::TYPE_INT, # hInstall : MSIHANDLE
Fiddle::TYPE_VOIDP, # szFolder : LPCSTR
Fiddle::TYPE_VOIDP, # szFolderPath : LPCSTR
],
-Fiddle::TYPE_INT)#[link(name = "msi")]
extern "system" {
fn MsiSetTargetPathA(
hInstall: u32, // MSIHANDLE
szFolder: *const u8, // LPCSTR
szFolderPath: *const u8 // LPCSTR
) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("msi.dll", CharSet = CharSet.Ansi)]
public static extern uint MsiSetTargetPathA(uint hInstall, [MarshalAs(UnmanagedType.LPStr)] string szFolder, [MarshalAs(UnmanagedType.LPStr)] string szFolderPath);
"@
$api = Add-Type -MemberDefinition $sig -Name 'msi_MsiSetTargetPathA' -Namespace Win32 -PassThru
# $api::MsiSetTargetPathA(hInstall, szFolder, szFolderPath)#uselib "msi.dll"
#func global MsiSetTargetPathA "MsiSetTargetPathA" sptr, sptr, sptr
; MsiSetTargetPathA hInstall, szFolder, szFolderPath ; 戻り値は stat
; hInstall : MSIHANDLE -> "sptr"
; szFolder : LPCSTR -> "sptr"
; szFolderPath : LPCSTR -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "msi.dll"
#cfunc global MsiSetTargetPathA "MsiSetTargetPathA" int, str, str
; res = MsiSetTargetPathA(hInstall, szFolder, szFolderPath)
; hInstall : MSIHANDLE -> "int"
; szFolder : LPCSTR -> "str"
; szFolderPath : LPCSTR -> "str"; DWORD MsiSetTargetPathA(MSIHANDLE hInstall, LPCSTR szFolder, LPCSTR szFolderPath)
#uselib "msi.dll"
#cfunc global MsiSetTargetPathA "MsiSetTargetPathA" int, str, str
; res = MsiSetTargetPathA(hInstall, szFolder, szFolderPath)
; hInstall : MSIHANDLE -> "int"
; szFolder : LPCSTR -> "str"
; szFolderPath : LPCSTR -> "str"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
msi = windows.NewLazySystemDLL("msi.dll")
procMsiSetTargetPathA = msi.NewProc("MsiSetTargetPathA")
)
// hInstall (MSIHANDLE), szFolder (LPCSTR), szFolderPath (LPCSTR)
r1, _, err := procMsiSetTargetPathA.Call(
uintptr(hInstall),
uintptr(unsafe.Pointer(windows.BytePtrFromString(szFolder))),
uintptr(unsafe.Pointer(windows.BytePtrFromString(szFolderPath))),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // DWORDfunction MsiSetTargetPathA(
hInstall: DWORD; // MSIHANDLE
szFolder: PAnsiChar; // LPCSTR
szFolderPath: PAnsiChar // LPCSTR
): DWORD; stdcall;
external 'msi.dll' name 'MsiSetTargetPathA';result := DllCall("msi\MsiSetTargetPathA"
, "UInt", hInstall ; MSIHANDLE
, "AStr", szFolder ; LPCSTR
, "AStr", szFolderPath ; LPCSTR
, "UInt") ; return: DWORD●MsiSetTargetPathA(hInstall, szFolder, szFolderPath) = DLL("msi.dll", "dword MsiSetTargetPathA(dword, char*, char*)")
# 呼び出し: MsiSetTargetPathA(hInstall, szFolder, szFolderPath)
# hInstall : MSIHANDLE -> "dword"
# szFolder : LPCSTR -> "char*"
# szFolderPath : LPCSTR -> "char*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。