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