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

MsiGetDatabaseState

関数
データベースが読み取り専用か書き込み可能かの状態を取得する。
DLLmsi.dll呼出規約winapi対応OSwindows8.0

シグネチャ

// msi.dll
#include <windows.h>

MSIDBSTATE MsiGetDatabaseState(
    MSIHANDLE hDatabase
);

パラメーター

名前方向
hDatabaseMSIHANDLEin

戻り値の型: MSIDBSTATE

各言語での呼び出し定義

// msi.dll
#include <windows.h>

MSIDBSTATE MsiGetDatabaseState(
    MSIHANDLE hDatabase
);
[DllImport("msi.dll", ExactSpelling = true)]
static extern int MsiGetDatabaseState(
    uint hDatabase   // MSIHANDLE
);
<DllImport("msi.dll", ExactSpelling:=True)>
Public Shared Function MsiGetDatabaseState(
    hDatabase As UInteger   ' MSIHANDLE
) As Integer
End Function
' hDatabase : MSIHANDLE
Declare PtrSafe Function MsiGetDatabaseState Lib "msi" ( _
    ByVal hDatabase As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

MsiGetDatabaseState = ctypes.windll.msi.MsiGetDatabaseState
MsiGetDatabaseState.restype = ctypes.c_int
MsiGetDatabaseState.argtypes = [
    wintypes.DWORD,  # hDatabase : MSIHANDLE
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('msi.dll')
MsiGetDatabaseState = Fiddle::Function.new(
  lib['MsiGetDatabaseState'],
  [
    -Fiddle::TYPE_INT,  # hDatabase : MSIHANDLE
  ],
  Fiddle::TYPE_INT)
#[link(name = "msi")]
extern "system" {
    fn MsiGetDatabaseState(
        hDatabase: u32  // MSIHANDLE
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("msi.dll")]
public static extern int MsiGetDatabaseState(uint hDatabase);
"@
$api = Add-Type -MemberDefinition $sig -Name 'msi_MsiGetDatabaseState' -Namespace Win32 -PassThru
# $api::MsiGetDatabaseState(hDatabase)
#uselib "msi.dll"
#func global MsiGetDatabaseState "MsiGetDatabaseState" sptr
; MsiGetDatabaseState hDatabase   ; 戻り値は stat
; hDatabase : MSIHANDLE -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "msi.dll"
#cfunc global MsiGetDatabaseState "MsiGetDatabaseState" int
; res = MsiGetDatabaseState(hDatabase)
; hDatabase : MSIHANDLE -> "int"
; MSIDBSTATE MsiGetDatabaseState(MSIHANDLE hDatabase)
#uselib "msi.dll"
#cfunc global MsiGetDatabaseState "MsiGetDatabaseState" int
; res = MsiGetDatabaseState(hDatabase)
; hDatabase : MSIHANDLE -> "int"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	msi = windows.NewLazySystemDLL("msi.dll")
	procMsiGetDatabaseState = msi.NewProc("MsiGetDatabaseState")
)

// hDatabase (MSIHANDLE)
r1, _, err := procMsiGetDatabaseState.Call(
	uintptr(hDatabase),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // MSIDBSTATE
function MsiGetDatabaseState(
  hDatabase: DWORD   // MSIHANDLE
): Integer; stdcall;
  external 'msi.dll' name 'MsiGetDatabaseState';
result := DllCall("msi\MsiGetDatabaseState"
    , "UInt", hDatabase   ; MSIHANDLE
    , "Int")   ; return: MSIDBSTATE
●MsiGetDatabaseState(hDatabase) = DLL("msi.dll", "int MsiGetDatabaseState(dword)")
# 呼び出し: MsiGetDatabaseState(hDatabase)
# hDatabase : MSIHANDLE -> "dword"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。